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