]>
Commit | Line | Data |
---|---|---|
b2db72f4 MK |
1 | # TODO: |
2 | # - fix docs | |
3 | # Conditional build: | |
4 | %bcond_with doc # don't build doc | |
5 | %bcond_with tests # do not perform "make test" | |
6 | %bcond_without python2 # CPython 2.x module | |
7 | %bcond_without python3 # CPython 3.x module | |
8 | ||
9 | # NOTE: 'module' should match the python import path, not the egg name | |
10 | %define module traitlets | |
11 | Summary: A configuration system for Python applications | |
12 | Summary(pl.UTF-8): System konfiguracji dla aplikacji w Pythonie. | |
13 | Name: python-%{module} | |
14 | Version: 4.3.2 | |
15 | Release: 1 | |
16 | License: BSD | |
17 | Group: Libraries/Python | |
18 | Source0: https://github.com/ipython/traitlets/archive/%{version}.tar.gz | |
19 | # Source0-md5: 0b5b7986aef676d12f31a16cbbe3ed92 | |
20 | URL: https://traitlets.readthedocs.io/en/stable/ | |
21 | BuildRequires: rpm-pythonprov | |
22 | # for the py_build, py_install macros | |
23 | BuildRequires: rpmbuild(macros) >= 1.714 | |
24 | %if %{with python2} | |
25 | BuildRequires: python-modules | |
26 | BuildRequires: python-setuptools | |
27 | BuildRequires: python-sphinx_rtd_theme | |
28 | %endif | |
29 | %if %{with python3} | |
30 | BuildRequires: python3-modules | |
31 | BuildRequires: python3-setuptools | |
32 | BuildRequires: python3-sphinx_rtd_theme | |
33 | ||
34 | %endif | |
35 | # when using /usr/bin/env or other in-place substitutions | |
36 | #BuildRequires: sed >= 4.0 | |
37 | # replace with other requires if defined in setup.py | |
38 | Requires: python-modules | |
39 | BuildArch: noarch | |
40 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
41 | ||
42 | %description | |
43 | Traitlets is a framework that lets Python classes have attributes with | |
44 | type checking, dynamically calculated default values, and ‘on change’ | |
45 | callbacks. | |
46 | ||
47 | %description -l pl.UTF-8 | |
48 | System konfiguracji dla aplikacji w Pythonie. | |
49 | ||
50 | %package -n python3-%{module} | |
51 | Summary: - | |
52 | Summary(pl.UTF-8): - | |
53 | Group: Libraries/Python | |
54 | Requires: python3-modules | |
55 | ||
56 | %description -n python3-%{module} | |
57 | ||
58 | %description -n python3-%{module} -l pl.UTF-8 | |
59 | ||
60 | %package apidocs | |
61 | Summary: %{module} API documentation | |
62 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
63 | Group: Documentation | |
64 | ||
65 | %description apidocs | |
66 | API documentation for %{module}. | |
67 | ||
68 | %description apidocs -l pl.UTF-8 | |
69 | Dokumentacja API %{module}. | |
70 | ||
71 | %prep | |
72 | %setup -q -n %{module}-%{version} | |
73 | ||
74 | #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py | |
75 | ||
76 | %build | |
77 | %if %{with python2} | |
78 | %py_build %{?with_tests:test} | |
79 | %endif | |
80 | ||
81 | %if %{with python3} | |
82 | %py3_build %{?with_tests:test} | |
83 | %endif | |
84 | ||
85 | %if %{with doc} | |
86 | cd docs | |
87 | %{__make} -j1 html | |
88 | rm -rf _build/html/_sources | |
89 | %endif | |
90 | ||
91 | %install | |
92 | rm -rf $RPM_BUILD_ROOT | |
93 | ||
94 | %if %{with python2} | |
95 | %py_install | |
96 | ||
97 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
98 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
99 | ||
100 | %py_postclean | |
101 | %endif | |
102 | ||
103 | %if %{with python3} | |
104 | %py3_install | |
105 | %endif | |
106 | ||
107 | # in case there are examples provided | |
108 | %if %{with python2} | |
109 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
110 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
111 | find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \ | |
112 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
113 | %endif | |
114 | %if %{with python3} | |
115 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
116 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
117 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
118 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
119 | %endif | |
120 | ||
121 | %clean | |
122 | rm -rf $RPM_BUILD_ROOT | |
123 | ||
124 | %if %{with python2} | |
125 | %files | |
126 | %defattr(644,root,root,755) | |
127 | %doc README.md | |
128 | %{py_sitescriptdir}/%{module} | |
129 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
130 | %{_examplesdir}/python-%{module}-%{version} | |
131 | %endif | |
132 | ||
133 | %if %{with python3} | |
134 | %files -n python3-%{module} | |
135 | %defattr(644,root,root,755) | |
136 | %doc README.md | |
137 | %{py3_sitescriptdir}/%{module} | |
138 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
139 | %{_examplesdir}/python3-%{module}-%{version} | |
140 | %endif | |
141 | ||
142 | %if %{with doc} | |
143 | %files apidocs | |
144 | %defattr(644,root,root,755) | |
145 | %doc docs/_build/html/* | |
146 | %endif |