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