]>
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 | |
19247e7d | 19 | BuildRequires: rpmbuild(macros) >= 1.710 |
bee57211 JK |
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 | |
bee57211 JK |
28 | %{?with_tests:BuildRequires: python3-mock} |
29 | BuildRequires: python3-modules | |
30 | %endif | |
31 | Requires: python-modules | |
32 | BuildArch: noarch | |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %description | |
36 | Libcloud is a Python library for interacting with many of the popular | |
37 | cloud service providers using a unified API. It was created to make it | |
38 | easy for developers to build products that work between any of the | |
39 | services that it supports. | |
40 | ||
41 | Resource you can manage with Libcloud are divided in the following | |
42 | categories: | |
43 | ||
44 | - Cloud Servers and Block Storage - services such as Amazon EC2 and | |
45 | Rackspace CloudServers | |
46 | - Cloud Object Storage and CDN - services such as Amazon S3 and | |
47 | Rackspace CloudFiles | |
48 | - Load Balancers as a Service - services such as Amazon Elastic Load | |
49 | Balancer and GoGrid LoadBalancers | |
50 | - DNS as a Service - services such as Amazon Route 53 and Zerigo | |
51 | ||
52 | %package -n python3-%{module} | |
53 | Summary: Unified Python API for cloud service providers | |
54 | Group: Libraries/Python | |
55 | ||
56 | %description -n python3-%{module} | |
57 | Libcloud is a Python library for interacting with many of the popular | |
58 | cloud service providers using a unified API. It was created to make it | |
59 | easy for developers to build products that work between any of the | |
60 | services that it supports. | |
61 | ||
62 | Resource you can manage with Libcloud are divided in the following | |
63 | categories: | |
64 | ||
65 | - Cloud Servers and Block Storage - services such as Amazon EC2 and | |
66 | Rackspace CloudServers | |
67 | - Cloud Object Storage and CDN - services such as Amazon S3 and | |
68 | Rackspace CloudFiles | |
69 | - Load Balancers as a Service - services such as Amazon Elastic Load | |
70 | Balancer and GoGrid LoadBalancers | |
71 | - DNS as a Service - services such as Amazon Route 53 and Zerigo | |
72 | ||
73 | %prep | |
74 | %setup -q -n apache-%{module}-%{version} | |
75 | ||
76 | %patch0 -p1 | |
77 | ||
78 | cp libcloud/test/secrets.py-dist libcloud/test/secrets.py | |
79 | ||
80 | %{__sed} -i -e '1s,^#!.*python,#!%{__python},' demos/*.py example_*.py | |
81 | ||
82 | %build | |
83 | %if %{with python2} | |
3aa3cea4 | 84 | %py_build %{?with_tests:test} |
bee57211 JK |
85 | %endif |
86 | ||
87 | %if %{with python3} | |
3aa3cea4 | 88 | %py3_build %{?with_tests:test} |
bee57211 JK |
89 | %endif |
90 | ||
91 | %install | |
92 | rm -rf $RPM_BUILD_ROOT | |
93 | ||
94 | %if %{with python2} | |
3aa3cea4 | 95 | %py_install |
bee57211 JK |
96 | |
97 | %py_postclean | |
98 | %endif | |
99 | ||
100 | %if %{with python3} | |
3aa3cea4 | 101 | %py3_install |
bee57211 JK |
102 | %endif |
103 | ||
104 | %if %{with python2} | |
105 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
106 | cp -a example_*.py demos $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
107 | %endif | |
108 | %if %{with python3} | |
109 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
110 | cp -a example_*.py demos $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
111 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
112 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
113 | %endif | |
114 | ||
115 | %clean | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
118 | %if %{with python2} | |
119 | %files | |
120 | %defattr(644,root,root,755) | |
121 | %doc CHANGES.rst NOTICE README.rst | |
122 | %{py_sitescriptdir}/%{module} | |
123 | %if "%{py_ver}" > "2.4" | |
124 | %{py_sitescriptdir}/*.egg-info | |
125 | %endif | |
126 | %{_examplesdir}/%{name}-%{version} | |
127 | %endif | |
128 | ||
129 | %if %{with python3} | |
130 | %files -n python3-%{module} | |
131 | %defattr(644,root,root,755) | |
132 | %doc CHANGES.rst NOTICE README.rst | |
133 | %{py3_sitescriptdir}/%{module} | |
134 | %{py3_sitescriptdir}/*.egg-info | |
135 | %{_examplesdir}/python3-%{module}-%{version} | |
136 | %endif |