]> git.pld-linux.org Git - packages/python-pyxs.git/blob - python-pyxs.spec
e935c734b1d859881f9962a3a4b5a9e80bbfbffc
[packages/python-pyxs.git] / python-pyxs.spec
1 #
2 # Conditional build:
3 %bcond_with     doc     # build doc (not in source tarball)
4 %bcond_with     tests   # do run tests (not in source tarball)
5 %bcond_without  python2 # CPython 2.x module
6 %bcond_without  python3 # CPython 3.x module
7
8 %define         module  pyxs
9 Summary:        pyxs - XenStore access the Python way
10 Summary(pl.UTF-8):      pyxs - pythonowy dostęp do XenStore
11 Name:           python-%{module}
12 Version:        0.4.0
13 Release:        1
14 License:        LGPL v3
15 Group:          Libraries/Python
16 Source0:        https://pypi.python.org/packages/source/p/pyxs/%{module}-%{version}.tar.gz
17 # Source0-md5:  cbf42444287ea82e4d0877c3be55ea06
18 URL:            https://github.com/selectel/pyxs
19 BuildRequires:  rpm-pythonprov
20 BuildRequires:  rpmbuild(macros) >= 1.714
21 %if %{with python2}
22 BuildRequires:  python-modules >= 1:2.6
23 BuildRequires:  python-setuptools
24 BuildRequires:  python-pytest-runner
25 %if %{with tests}
26 BuildRequires:  python-pytest
27 %endif
28 %endif
29 %if %{with python3}
30 BuildRequires:  python3-modules >= 3.4
31 BuildRequires:  python3-setuptools
32 BuildRequires:  python3-pytest-runner
33 %if %{with tests}
34 BuildRequires:  python3-pytest
35 %endif
36 %endif
37 %if %{with docs}
38 BuildRequires:  sphinx-pdg
39 %endif
40 Requires:       python-modules
41 BuildArch:      noarch
42 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44 %description
45 pyxs a pure Python XenStore client implementation, which covers all of
46 the libxs features and adds some nice Pythonic sugar on top. Here's a
47 shortlist:
48
49 - pyxs supports both Python 2 and 3,
50 - works over a Unix socket or XenBus,
51 - has a clean and well-documented API,
52 - is writen in easy to understand Python,
53 - can be used with gevent or eventlet.
54
55 %package -n python3-%{module}
56 Summary:        pyxs - XenStore access the Python way
57 Summary(pl.UTF-8):      pyxs - pythonowy dostęp do XenStore
58 Group:          Libraries/Python
59 Requires:       python3-modules
60
61 %description -n python3-%{module}
62 pyxs a pure Python XenStore client implementation, which covers all of
63 the libxs features and adds some nice Pythonic sugar on top. Here's a
64 shortlist:
65
66 - pyxs supports both Python 2 and 3,
67 - works over a Unix socket or XenBus,
68 - has a clean and well-documented API,
69 - is writen in easy to understand Python,
70 - can be used with gevent or eventlet.
71
72 %package apidocs
73 Summary:        %{module} API documentation
74 Summary(pl.UTF-8):      Dokumentacja API %{module}
75 Group:          Documentation
76
77 %description apidocs
78 API documentation for %{module}.
79
80 %description apidocs -l pl.UTF-8
81 Dokumentacja API %{module}.
82
83 %prep
84 %setup -q -n %{module}-%{version}
85
86 %build
87 %if %{with python2}
88 %py_build %{?with_tests:test}
89 %endif
90
91 %if %{with python3}
92 %py3_build %{?with_tests:test}
93 %endif
94
95 %if %{with doc}
96 cd docs
97 %{__make} -j1 html
98 rm -rf _build/html/_sources
99 %endif
100
101 %install
102 rm -rf $RPM_BUILD_ROOT
103
104 %if %{with python2}
105 %py_install
106
107 %py_postclean
108 %endif
109
110 %if %{with python3}
111 %py3_install
112 %endif
113
114 # in case there are examples provided
115 %if %{with python2}
116 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
117 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
118 %endif
119 %if %{with python3}
120 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
121 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
122 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
123         | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
124 %endif
125
126 %clean
127 rm -rf $RPM_BUILD_ROOT
128
129 %if %{with python2}
130 %files
131 %defattr(644,root,root,755)
132 %doc AUTHORS CHANGES README
133 %{py_sitescriptdir}/%{module}
134 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
135 %{_examplesdir}/%{name}-%{version}
136 %endif
137
138 %if %{with python3}
139 %files -n python3-%{module}
140 %defattr(644,root,root,755)
141 %doc AUTHORS CHANGES README
142 %{py3_sitescriptdir}/%{module}
143 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
144 %{_examplesdir}/python3-%{module}-%{version}
145 %endif
146
147 %if %{with doc}
148 %files apidocs
149 %defattr(644,root,root,755)
150 %doc docs/_build/html/*
151 %endif
This page took 0.121649 seconds and 2 git commands to generate.