]>
Commit | Line | Data |
---|---|---|
20b1c3b0 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with doc # don't build doc | |
4 | %bcond_with tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
c0b85897 | 6 | %bcond_with python3 # CPython 3.x module |
20b1c3b0 ER |
7 | |
8 | %define module gitlab | |
9 | %define egg_name python_gitlab | |
10 | %define pypi_name python-gitlab | |
11 | Summary: Interact with GitLab API | |
12 | Name: python-gitlab | |
13 | Version: 0.16 | |
14 | Release: 1 | |
15 | License: LGPLv3 | |
16 | Group: Libraries/Python | |
17 | Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz | |
18 | # Source0-md5: e0421d930718021e7d796d74d2ad7194 | |
25586f60 | 19 | Source1: config.cfg |
20b1c3b0 ER |
20 | URL: https://github.com/gpocentek/python-gitlab |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-devel | |
25 | BuildRequires: python-setuptools | |
26 | BuildRequires: sphinx-pdg | |
27 | %endif | |
28 | %if %{with python3} | |
29 | BuildRequires: python3-devel | |
30 | BuildRequires: python3-setuptools | |
31 | %endif | |
32 | BuildArch: noarch | |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %description | |
36 | Interact with GitLab API | |
37 | ||
38 | %package -n python3-gitlab | |
39 | Summary: Interact with GitLab API | |
40 | Group: Libraries/Python | |
41 | ||
42 | %description -n python3-gitlab | |
43 | Interact with GitLab API | |
44 | ||
45 | %prep | |
46 | %setup -q | |
47 | ||
48 | # Remove bundled egg-info | |
49 | %{__rm} -r %{module}.egg-info | |
50 | ||
51 | %build | |
52 | %if %{with python2} | |
53 | %py_build %{?with_tests:test} | |
54 | ||
55 | %if %{with doc} | |
56 | sphinx-build-2 docs html | |
57 | %{__rm} -r html/.{doctrees,buildinfo} | |
58 | %endif | |
59 | %endif | |
60 | ||
61 | %if %{with python3} | |
62 | %py3_build %{?with_tests:test} | |
63 | ||
64 | %if %{with doc} | |
65 | sphinx-build-3 docs html | |
66 | %{__rm} -r html/.{doctrees,buildinfo} | |
67 | %endif | |
68 | %endif | |
69 | ||
70 | %install | |
71 | rm -rf $RPM_BUILD_ROOT | |
72 | %if %{with python2} | |
73 | %py_install | |
74 | %py_postclean | |
75 | mv $RPM_BUILD_ROOT%{_bindir}/gitlab $RPM_BUILD_ROOT%{_bindir}/gitlab-2 | |
76 | %endif | |
77 | ||
78 | %if %{with python3} | |
79 | %py3_install | |
80 | mv $RPM_BUILD_ROOT%{_bindir}/gitlab $RPM_BUILD_ROOT%{_bindir}/gitlab-3 | |
81 | %endif | |
82 | ||
c0b85897 | 83 | install -d $RPM_BUILD_ROOT%{_sysconfdir} |
25586f60 | 84 | cp -p %{_sourcedir}/config.cfg $RPM_BUILD_ROOT%{_sysconfdir}/python-gitlab.cfg |
c0b85897 | 85 | |
ef3bd57d ER |
86 | ln -s gitlab-2 $RPM_BUILD_ROOT%{_bindir}/gitlab |
87 | ||
20b1c3b0 ER |
88 | %clean |
89 | rm -rf $RPM_BUILD_ROOT | |
90 | ||
91 | %if %{with python2} | |
92 | %files | |
93 | %defattr(644,root,root,755) | |
94 | %doc README.rst | |
c0b85897 | 95 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg |
20b1c3b0 | 96 | %attr(755,root,root) %{_bindir}/gitlab-2 |
ef3bd57d | 97 | %attr(755,root,root) %{_bindir}/gitlab |
20b1c3b0 ER |
98 | %{py_sitescriptdir}/%{module} |
99 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
100 | %endif | |
101 | ||
102 | %if %{with python3} | |
103 | %files -n python3-gitlab | |
104 | %defattr(644,root,root,755) | |
105 | %doc README.rst | |
c0b85897 | 106 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg |
20b1c3b0 ER |
107 | %attr(755,root,root) %{_bindir}/gitlab-3 |
108 | %{py3_sitescriptdir}/%{module} | |
109 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
110 | %endif |