forked from openstack-packages/openstack-example-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python-example-library.spec
148 lines (105 loc) · 3.13 KB
/
python-example-library.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
# Python3 support in OpenStack starts with version 3.5,
# which is only in Fedora 24+
%if 0%{?fedora} >= 24
%global with_python3 1
%endif
%global library example-library
%global module example_library
Name: python-%{library}
Version: XXX
Release: XXX
Summary: OpenStack Example library
License: ASL 2.0
URL: http://launchpad.net/%{library}/
Source0: http://tarballs.openstack.org/%{library}/%{library}-master.tar.gz
BuildArch: noarch
%package -n python2-%{library}
Summary: OpenStack Example library
%{?python_provide:%python_provide python2-%{library}}
BuildRequires: python2-devel
BuildRequires: python-pbr
BuildRequires: python-setuptools
BuildRequires: git
Requires: python-oslo-config >= 2:3.4.0
%description -n python2-%{library}
OpenStack example library.
%package -n python2-%{library}-tests
Summary: OpenStack example library tests
Requires: python2-%{library} = %{version}-%{release}
%description -n python2-%{library}-tests
OpenStack example library.
This package contains the example library test files.
%package -n python-%{library}-doc
Summary: OpenStack example library documentation
BuildRequires: python-sphinx
BuildRequires: python-oslo-sphinx
%description -n python-%{library}-doc
OpenStack example library.
This package contains the documentation.
%if 0%{?with_python3}
%package -n python3-%{library}
Summary: OpenStack Example library
%{?python_provide:%python_provide python3-%{library}}
BuildRequires: python3-devel
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
BuildRequires: git
Requires: python3-oslo-config >= 2:3.4.0
%description -n python3-%{library}
OpenStack example library.
%package -n python3-%{library}-tests
Summary: OpenStack example library tests
Requires: python3-%{library} = %{version}-%{release}
%description -n python3-%{library}-tests
OpenStack example library.
This package contains the example library test files.
%endif # with_python3
%description
OpenStack example library.
%prep
%autosetup -n %{library}-%{upstream_version} -S git
# Let's handle dependencies ourseleves
rm -f *requirements.txt
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
# generate html docs
sphinx-build doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
%py2_install
%if 0%{?with_python3}
%py3_install
%endif
%check
%if 0%{?with_python3}
%{__python3} setup.py test
rm -rf .testrepository
%endif
%{__python2} setup.py test
%files -n python2-%{library}
%license LICENSE
%{python2_sitelib}/%{module}
%{python2_sitelib}/%{module}-*.egg-info
%exclude %{python2_sitelib}/%{module}/tests
%files -n python2-%{library}-tests
%license LICENSE
%{python2_sitelib}/%{module}/tests
%files -n python-%{library}-doc
%license LICENSE
%doc html README.rst
%if 0%{?with_python3}
%files python3-%{library}
%license LICENSE
%{python3_sitelib}/%{module}
%{python3_sitelib}/%{module}-*.egg-info
%exclude %{python3_sitelib}/%{module}/tests
%files -n python3-%{library}-tests
%license LICENSE
%{python3_sitelib}/%{module}/tests
%endif # with_python3
%changelog