]>
Commit | Line | Data |
---|---|---|
bee57211 JK |
1 | # |
2 | # Conditional build: | |
6dc6d653 | 3 | %bcond_with tests # do not perform "make test" (they use network) |
bee57211 JK |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module libcloud | |
8 | Summary: Unified Python API for cloud service providers | |
9 | Name: python-%{module} | |
10 | Version: 0.14.1 | |
11 | Release: 1 | |
12 | License: Apache v2.0 | |
13 | Group: Libraries/Python | |
14 | Source0: ftp://apache.cs.utah.edu/apache.org/libcloud/apache-%{module}-%{version}.tar.bz2 | |
15 | # Source0-md5: 0270c54b3f61a60a008271d92addb7b8 | |
16 | Patch0: cacerts_path.patch | |
17 | URL: https://libcloud.apache.org/ | |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.219 | |
20 | BuildRequires: sed >= 4.0 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-devel | |
23 | BuildRequires: python-distribute | |
24 | %{?with_tests:BuildRequires: python-mock} | |
25 | %endif | |
26 | %if %{with python3} | |
27 | BuildRequires: python3-devel | |
28 | BuildRequires: python3-distribute | |
29 | %{?with_tests:BuildRequires: python3-mock} | |
30 | BuildRequires: python3-modules | |
31 | %endif | |
32 | Requires: python-modules | |
33 | BuildArch: noarch | |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | Libcloud is a Python library for interacting with many of the popular | |
38 | cloud service providers using a unified API. It was created to make it | |
39 | easy for developers to build products that work between any of the | |
40 | services that it supports. | |
41 | ||
42 | Resource you can manage with Libcloud are divided in the following | |
43 | categories: | |
44 | ||
45 | - Cloud Servers and Block Storage - services such as Amazon EC2 and | |
46 | Rackspace CloudServers | |
47 | - Cloud Object Storage and CDN - services such as Amazon S3 and | |
48 | Rackspace CloudFiles | |
49 | - Load Balancers as a Service - services such as Amazon Elastic Load | |
50 | Balancer and GoGrid LoadBalancers | |
51 | - DNS as a Service - services such as Amazon Route 53 and Zerigo | |
52 | ||
53 | %package -n python3-%{module} | |
54 | Summary: Unified Python API for cloud service providers | |
55 | Group: Libraries/Python | |
56 | ||
57 | %description -n python3-%{module} | |
58 | Libcloud is a Python library for interacting with many of the popular | |
59 | cloud service providers using a unified API. It was created to make it | |
60 | easy for developers to build products that work between any of the | |
61 | services that it supports. | |
62 | ||
63 | Resource you can manage with Libcloud are divided in the following | |
64 | categories: | |
65 | ||
66 | - Cloud Servers and Block Storage - services such as Amazon EC2 and | |
67 | Rackspace CloudServers | |
68 | - Cloud Object Storage and CDN - services such as Amazon S3 and | |
69 | Rackspace CloudFiles | |
70 | - Load Balancers as a Service - services such as Amazon Elastic Load | |
71 | Balancer and GoGrid LoadBalancers | |
72 | - DNS as a Service - services such as Amazon Route 53 and Zerigo | |
73 | ||
74 | %prep | |
75 | %setup -q -n apache-%{module}-%{version} | |
76 | ||
77 | %patch0 -p1 | |
78 | ||
79 | cp libcloud/test/secrets.py-dist libcloud/test/secrets.py | |
80 | ||
81 | %{__sed} -i -e '1s,^#!.*python,#!%{__python},' demos/*.py example_*.py | |
82 | ||
83 | %build | |
84 | %if %{with python2} | |
85 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} | |
86 | %endif | |
87 | ||
88 | %if %{with python3} | |
89 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} | |
90 | %endif | |
91 | ||
92 | %install | |
93 | rm -rf $RPM_BUILD_ROOT | |
94 | ||
95 | %if %{with python2} | |
96 | %{__python} setup.py \ | |
97 | build --build-base build-2 \ | |
98 | install --skip-build \ | |
99 | --optimize=2 \ | |
100 | --root=$RPM_BUILD_ROOT | |
101 | ||
102 | %py_postclean | |
103 | %endif | |
104 | ||
105 | %if %{with python3} | |
106 | %{__python3} setup.py \ | |
107 | build --build-base build-3 \ | |
108 | install --skip-build \ | |
109 | --optimize=2 \ | |
110 | --root=$RPM_BUILD_ROOT | |
111 | %endif | |
112 | ||
113 | %if %{with python2} | |
114 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
115 | cp -a example_*.py demos $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
116 | %endif | |
117 | %if %{with python3} | |
118 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
119 | cp -a example_*.py demos $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
120 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
121 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
122 | %endif | |
123 | ||
124 | %clean | |
125 | rm -rf $RPM_BUILD_ROOT | |
126 | ||
127 | %if %{with python2} | |
128 | %files | |
129 | %defattr(644,root,root,755) | |
130 | %doc CHANGES.rst NOTICE README.rst | |
131 | %{py_sitescriptdir}/%{module} | |
132 | %if "%{py_ver}" > "2.4" | |
133 | %{py_sitescriptdir}/*.egg-info | |
134 | %endif | |
135 | %{_examplesdir}/%{name}-%{version} | |
136 | %endif | |
137 | ||
138 | %if %{with python3} | |
139 | %files -n python3-%{module} | |
140 | %defattr(644,root,root,755) | |
141 | %doc CHANGES.rst NOTICE README.rst | |
142 | %{py3_sitescriptdir}/%{module} | |
143 | %{py3_sitescriptdir}/*.egg-info | |
144 | %{_examplesdir}/python3-%{module}-%{version} | |
145 | %endif |