]>
Commit | Line | Data |
---|---|---|
bdab460e ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module docker | |
8 | Summary: An API client for docker written in Python | |
9 | Name: python-%{module} | |
10 | Version: 0.7.1 | |
11 | Release: 1 | |
12 | License: Apache v2.0 | |
13 | Group: Libraries/Python | |
14 | Source0: https://pypi.python.org/packages/source/d/docker-py/docker-py-%{version}.tar.gz | |
15 | # Source0-md5: 3950ac21f7f2a9723759dd95e5f77b89 | |
16 | URL: http://docker-py.readthedocs.org/ | |
17 | #BuildRequires: docker >= 1.3.3 | |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.219 | |
20 | %if %{with python2} | |
21 | BuildRequires: python-requests >= 2.2.1 | |
22 | BuildRequires: python-setuptools | |
23 | #BuildRequires: python-tools | |
24 | #BuildRequires: python-websocket-client >= 0.11.0 | |
25 | %endif | |
26 | %if %{with python3} | |
27 | BuildRequires: python3-devel | |
28 | BuildRequires: python3-requests | |
29 | BuildRequires: python3-setuptools | |
30 | #BuildRequires: python3-tools | |
31 | #BuildRequires: python3-websocket-client >= 0.11.0 | |
32 | %endif | |
33 | Requires: docker >= 1.3.3 | |
34 | Requires: python-requests >= 2.2.1 | |
35 | Requires: python-six >= 1.3.0 | |
36 | Requires: python-websocket-client >= 0.11.0 | |
37 | BuildArch: noarch | |
38 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
39 | ||
40 | %description | |
41 | An API client for docker written in Python. | |
42 | ||
43 | %package -n python3-%{module} | |
44 | Summary: An API client for docker written in Python 3 | |
45 | Requires: python3-requests | |
46 | Requires: python3-six >= 1.3.0 | |
47 | Requires: python3-websocket-client >= 0.11.0 | |
48 | ||
49 | %description -n python3-%{module} | |
50 | A Python 3 interface to Docker. | |
51 | ||
52 | %prep | |
53 | %setup -q -n docker-py-%{version} | |
54 | ||
55 | %if %{with python3} | |
56 | set -- * | |
57 | install -d py3 | |
58 | cp -a "$@" py3 | |
59 | find py3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' | |
60 | %endif | |
61 | ||
62 | %build | |
63 | %if %{with python2} | |
64 | %{__python} setup.py build %{?with_tests:test} | |
65 | %endif | |
66 | ||
67 | %if %{with python3} | |
68 | cd py3 | |
69 | %{__python3} setup.py build %{?with_tests:test} | |
70 | %endif | |
71 | ||
72 | %install | |
73 | rm -rf $RPM_BUILD_ROOT | |
74 | %if %{with python2} | |
75 | %{__python} setup.py install --skip-build \ | |
76 | --optimize=2 \ | |
77 | --root=$RPM_BUILD_ROOT | |
78 | ||
79 | %py_postclean | |
80 | %endif | |
81 | ||
82 | %if %{with python3} | |
83 | cd py3 | |
84 | %{__python3} setup.py install --skip-build \ | |
85 | --optimize=2 \ | |
86 | --root=$RPM_BUILD_ROOT | |
87 | %endif | |
88 | ||
89 | %clean | |
90 | rm -rf $RPM_BUILD_ROOT | |
91 | ||
92 | %if %{with python2} | |
93 | %files | |
94 | %defattr(644,root,root,755) | |
95 | %doc LICENSE README.md | |
96 | %{py_sitescriptdir}/%{module} | |
97 | %{py_sitescriptdir}/docker_py-%{version}-py*.egg-info | |
98 | %endif | |
99 | ||
100 | %if %{with python3} | |
101 | %files -n python3-%{module} | |
102 | %defattr(644,root,root,755) | |
103 | %doc LICENSE README.md | |
104 | %{py3_sitescriptdir}/%{module} | |
105 | %{py3_sitescriptdir}/docker_py-%{version}-py*.egg-info | |
106 | %endif |