]>
Commit | Line | Data |
---|---|---|
b460cd26 | 1 | # |
b2db72f4 | 2 | # Conditional build: |
b460cd26 JB |
3 | %bcond_without doc # API documentation |
4 | %bcond_without tests # unit tests | |
b2db72f4 MK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
b2db72f4 MK |
8 | %define module traitlets |
9 | Summary: A configuration system for Python applications | |
b460cd26 | 10 | Summary(pl.UTF-8): System konfiguracji dla aplikacji w Pythonie |
b2db72f4 MK |
11 | Name: python-%{module} |
12 | Version: 4.3.2 | |
b460cd26 | 13 | Release: 4 |
b2db72f4 MK |
14 | License: BSD |
15 | Group: Libraries/Python | |
b460cd26 JB |
16 | #Source0Download: https://github.com/ipython/traitlets/releases |
17 | # TODO: https://github.com/ipython/traitlets/archive/%{version}/%{module}-%{version}.tar.gz | |
b2db72f4 MK |
18 | Source0: https://github.com/ipython/traitlets/archive/%{version}.tar.gz |
19 | # Source0-md5: 0b5b7986aef676d12f31a16cbbe3ed92 | |
b460cd26 | 20 | Patch0: %{name}-use-setuptools.patch |
b2db72f4 | 21 | URL: https://traitlets.readthedocs.io/en/stable/ |
b2db72f4 | 22 | %if %{with python2} |
b460cd26 | 23 | BuildRequires: python-modules >= 1:2.7 |
b2db72f4 | 24 | BuildRequires: python-setuptools |
b460cd26 JB |
25 | %if %{with tests} |
26 | BuildRequires: python-decorator | |
27 | BuildRequires: python-enum34 | |
28 | BuildRequires: python-mock | |
29 | BuildRequires: python-pytest | |
30 | BuildRequires: python-six | |
31 | %endif | |
b2db72f4 MK |
32 | %endif |
33 | %if %{with python3} | |
b460cd26 | 34 | BuildRequires: python3-modules >= 1:3.3 |
b2db72f4 | 35 | BuildRequires: python3-setuptools |
b460cd26 JB |
36 | %if %{with tests} |
37 | BuildRequires: python3-decorator | |
38 | %if "%{py3_ver}" < "3.4" | |
39 | BuildRequires: python3-enum34 | |
40 | %endif | |
41 | BuildRequires: python3-pytest | |
42 | BuildRequires: python3-six | |
43 | %endif | |
44 | %endif | |
45 | BuildRequires: rpm-pythonprov | |
46 | BuildRequires: rpmbuild(macros) >= 1.714 | |
47 | %if %{with doc} | |
48 | BuildRequires: python3-ipython_genutils | |
b2db72f4 | 49 | BuildRequires: python3-sphinx_rtd_theme |
b460cd26 | 50 | BuildRequires: sphinx-pdg-3 |
b2db72f4 | 51 | %endif |
b460cd26 | 52 | Requires: python-modules >= 1:2.7 |
b2db72f4 MK |
53 | BuildArch: noarch |
54 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
55 | ||
56 | %description | |
57 | Traitlets is a framework that lets Python classes have attributes with | |
b460cd26 | 58 | type checking, dynamically calculated default values, and "on change" |
b2db72f4 MK |
59 | callbacks. |
60 | ||
61 | %description -l pl.UTF-8 | |
b460cd26 JB |
62 | Traitlets to szkielet pozwalający klasom Pythona na trzymanie |
63 | atrybutów ze sprawdzaniem typów, dynamicznie wyliczanymi wartościami | |
64 | domyślnymi oraz wywołaniami wstecznym "przy zmianie". | |
b2db72f4 MK |
65 | |
66 | %package -n python3-%{module} | |
b460cd26 JB |
67 | Summary: A configuration system for Python applications |
68 | Summary(pl.UTF-8): System konfiguracji dla aplikacji w Pythonie | |
b2db72f4 | 69 | Group: Libraries/Python |
b460cd26 | 70 | Requires: python3-modules >= 1:3.3 |
b2db72f4 MK |
71 | |
72 | %description -n python3-%{module} | |
b460cd26 JB |
73 | Traitlets is a framework that lets Python classes have attributes with |
74 | type checking, dynamically calculated default values, and "on change" | |
75 | callbacks. | |
b2db72f4 MK |
76 | |
77 | %description -n python3-%{module} -l pl.UTF-8 | |
b460cd26 JB |
78 | Traitlets to szkielet pozwalający klasom Pythona na trzymanie |
79 | atrybutów ze sprawdzaniem typów, dynamicznie wyliczanymi wartościami | |
80 | domyślnymi oraz wywołaniami wstecznym "przy zmianie". | |
b2db72f4 MK |
81 | |
82 | %package apidocs | |
83 | Summary: %{module} API documentation | |
84 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
85 | Group: Documentation | |
86 | ||
87 | %description apidocs | |
88 | API documentation for %{module}. | |
89 | ||
90 | %description apidocs -l pl.UTF-8 | |
91 | Dokumentacja API %{module}. | |
92 | ||
93 | %prep | |
94 | %setup -q -n %{module}-%{version} | |
b460cd26 | 95 | %patch0 -p1 |
b2db72f4 MK |
96 | |
97 | %build | |
98 | %if %{with python2} | |
b460cd26 JB |
99 | %py_build |
100 | ||
101 | %if %{with tests} | |
102 | %{__python} -m pytest traitlets | |
103 | %endif | |
b2db72f4 MK |
104 | %endif |
105 | ||
106 | %if %{with python3} | |
b460cd26 JB |
107 | %py3_build |
108 | ||
109 | %if %{with tests} | |
110 | %{__python3} -m pytest traitlets | |
111 | %endif | |
b2db72f4 MK |
112 | %endif |
113 | ||
114 | %if %{with doc} | |
b460cd26 JB |
115 | %{__make} -C docs html \ |
116 | SPHINXBUILD=sphinx-build-3 | |
b2db72f4 MK |
117 | %endif |
118 | ||
119 | %install | |
120 | rm -rf $RPM_BUILD_ROOT | |
121 | ||
122 | %if %{with python2} | |
123 | %py_install | |
124 | ||
b2db72f4 | 125 | %py_postclean |
b460cd26 JB |
126 | |
127 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
128 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
b2db72f4 MK |
129 | %endif |
130 | ||
131 | %if %{with python3} | |
132 | %py3_install | |
b2db72f4 | 133 | |
b2db72f4 | 134 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
b460cd26 | 135 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
b2db72f4 MK |
136 | %endif |
137 | ||
138 | %clean | |
139 | rm -rf $RPM_BUILD_ROOT | |
140 | ||
141 | %if %{with python2} | |
142 | %files | |
143 | %defattr(644,root,root,755) | |
b460cd26 JB |
144 | %doc COPYING.md README.md |
145 | %{py_sitescriptdir}/traitlets | |
146 | %{py_sitescriptdir}/traitlets-%{version}-py*.egg-info | |
b2db72f4 MK |
147 | %{_examplesdir}/python-%{module}-%{version} |
148 | %endif | |
149 | ||
150 | %if %{with python3} | |
151 | %files -n python3-%{module} | |
152 | %defattr(644,root,root,755) | |
b460cd26 JB |
153 | %doc COPYING.md README.md |
154 | %{py3_sitescriptdir}/traitlets | |
155 | %{py3_sitescriptdir}/traitlets-%{version}-py*.egg-info | |
b2db72f4 MK |
156 | %{_examplesdir}/python3-%{module}-%{version} |
157 | %endif | |
158 | ||
159 | %if %{with doc} | |
160 | %files apidocs | |
161 | %defattr(644,root,root,755) | |
b460cd26 | 162 | %doc docs/build/html/{_static,*.html,*.js} |
b2db72f4 | 163 | %endif |