]>
Commit | Line | Data |
---|---|---|
b3660d75 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python3 # CPython 3.x module | |
4 | %bcond_without tests # do not perform "make test" | |
5 | ||
6 | %define module dtopt | |
7 | Summary: Add options to doctest examples while they are running | |
8 | Name: python-%{module} | |
9 | Version: 0.1 | |
10 | Release: 1 | |
11 | License: MIT | |
12 | Group: Libraries/Python | |
13 | URL: http://pypi.python.org/pypi/dtopt/ | |
14 | Source0: http://pypi.python.org/packages/source/d/dtopt/dtopt-%{version}.tar.gz | |
15 | # Source0-md5: 9a41317149e926fcc408086aedee6bab | |
16 | BuildRequires: python-distribute | |
17 | BuildRequires: rpm-pythonprov | |
18 | BuildRequires: rpmbuild(macros) >= 1.219 | |
19 | %if %{with python3} | |
20 | BuildRequires: python3-devel | |
868f4860 | 21 | BuildRequires: python3-distribute |
d6bdfa6d | 22 | BuildRequires: python3-modules |
b3660d75 ER |
23 | %endif |
24 | BuildArch: noarch | |
25 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
26 | ||
27 | %description | |
28 | dtopts adds options to doctest examples while they are running. When | |
29 | using the doctest module it is often convenient to use the ELLIPSIS | |
30 | option, which allows you to use ... as a wildcard. But you either have | |
31 | to setup the test runner to use this option, or you must put #doctest: | |
32 | +ELLIPSIS on every example that uses this feature. dtopt lets you | |
33 | enable this option globally from within a doctest, by doing: >>> from | |
34 | dtopt import ELLIPSIS | |
35 | ||
36 | %package -n python3-dtopt | |
37 | Summary: Add options to doctest examples while they are running | |
38 | Group: Libraries/Python | |
39 | ||
40 | %description -n python3-dtopt | |
41 | dtopts adds options to doctest examples while they are running. When | |
42 | using the doctest module it is often convenient to use the ELLIPSIS | |
43 | option, which allows you to use ... as a wildcard. But you either have | |
44 | to setup the test runner to use this option, or you must put #doctest: | |
45 | +ELLIPSIS on every example that uses this feature. dtopt lets you | |
46 | enable this option globally from within a doctest, by doing: >>> from | |
47 | dtopt import ELLIPSIS | |
48 | ||
49 | %prep | |
50 | %setup -q -n %{module}-%{version} | |
51 | ||
52 | # Remove bundled egg info if it exists. | |
53 | rm -r *.egg-info | |
54 | ||
55 | %if %{with python3} | |
56 | rm -rf py3 | |
57 | set -- * | |
58 | install -d py3 | |
59 | cp -a "$@" py3 | |
60 | # There is a print statement in the test that is not python3 compatible. | |
61 | rm py3/dtopt/tests.py* | |
62 | %endif | |
63 | ||
64 | %build | |
65 | %{__python} setup.py build | |
66 | ||
67 | %if %{with python3} | |
68 | cd py3 | |
69 | %{__python3} setup.py build | |
70 | %endif | |
71 | ||
72 | %install | |
73 | rm -rf $RPM_BUILD_ROOT | |
74 | %{__python} setup.py install \ | |
75 | --skip-build \ | |
76 | --optimize=2 \ | |
77 | --root=$RPM_BUILD_ROOT | |
78 | ||
79 | %py_postclean | |
80 | ||
81 | %if %{with python3} | |
82 | cd py3 | |
83 | %{__python3} setup.py install \ | |
84 | --skip-build \ | |
85 | --optimize=2 \ | |
86 | --root=$RPM_BUILD_ROOT | |
87 | %endif | |
88 | ||
89 | %clean | |
90 | rm -rf $RPM_BUILD_ROOT | |
91 | ||
92 | %files | |
93 | %defattr(644,root,root,755) | |
94 | %doc docs/* | |
95 | %{py_sitescriptdir}/%{module} | |
96 | %{py_sitescriptdir}/%{module}-*.egg-info | |
97 | ||
98 | %if %{with python3} | |
99 | %files -n python3-dtopt | |
100 | %defattr(644,root,root,755) | |
101 | %doc docs/* | |
102 | %{py3_sitescriptdir}/%{module}/*.py | |
103 | %{py3_sitescriptdir}/%{module}/__pycache__ | |
104 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
105 | %endif |