]> git.pld-linux.org Git - packages/python-dtopt.git/blob - python-dtopt.spec
85f0c56f91c69f9965dac08099df6c6178f81e47
[packages/python-dtopt.git] / python-dtopt.spec
1 #
2 # Conditional build:
3 %bcond_without  python2 # CPython 2.x module
4 %bcond_without  python3 # CPython 3.x module
5 %bcond_without  tests   # unit tests
6
7 %define         module  dtopt
8 Summary:        Add options to doctest examples while they are running
9 Summary(pl.UTF-8):      Dodawanie opcji do przykładów doctest w trakcie ich działania
10 Name:           python-%{module}
11 Version:        0.1
12 Release:        11
13 License:        MIT
14 Group:          Libraries/Python
15 #Source0Download: https://pypi.org/simple/dtopt/
16 Source0:        https://files.pythonhosted.org/packages/source/d/dtopt/dtopt-%{version}.tar.gz
17 # Source0-md5:  9a41317149e926fcc408086aedee6bab
18 URL:            https://pypi.org/project/dtopt/
19 %if %{with python2}
20 BuildRequires:  python-setuptools
21 %endif
22 %if %{with python3}
23 BuildRequires:  python3-devel >= 1:3.2
24 BuildRequires:  python3-modules >= 1:3.2
25 BuildRequires:  python3-setuptools
26 %endif
27 BuildRequires:  rpm-pythonprov
28 BuildRequires:  rpmbuild(macros) >= 1.714
29 BuildArch:      noarch
30 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
31
32 %description
33 dtopts adds options to doctest examples while they are running. When
34 using the doctest module it is often convenient to use the ELLIPSIS
35 option, which allows you to use ... as a wildcard. But you either have
36 to setup the test runner to use this option, or you must put
37 "#doctest: +ELLIPSIS" on every example that uses this feature. dtopt
38 lets you enable this option globally from within a doctest, by doing:
39 >>> from dtopt import ELLIPSIS
40
41 %description -l pl.UTF-8
42 dtopts dodaje opcje do przykładów doctest w trakcie ich działania.
43 Przy korzystaniu z modułu doctest często wygodne jest użycie opcji
44 ELLIPSIS, pozwalającej na użycie ... jako maski globalnej. Ale albo
45 trzeba konfigurować narzędzie uruchamiające do użycia tej opcji, albo
46 umieszczać "#doctest: +ELLIPSIS" przy każdym przykładzie używającym
47 tej opcji. dtopt pozwala włączyć tę opcję globalnie z poziomu doctest
48 poprzez:
49 >>> from dtopt import ELLIPSIS
50
51 %package -n python3-dtopt
52 Summary:        Add options to doctest examples while they are running
53 Summary(pl.UTF-8):      Dodawanie opcji do przykładów doctest w trakcie ich działania
54 Group:          Libraries/Python
55
56 %description -n python3-dtopt
57 dtopts adds options to doctest examples while they are running. When
58 using the doctest module it is often convenient to use the ELLIPSIS
59 option, which allows you to use ... as a wildcard. But you either have
60 to setup the test runner to use this option, or you must put
61 "#doctest: +ELLIPSIS" on every example that uses this feature. dtopt
62 lets you enable this option globally from within a doctest, by doing:
63 >>> from dtopt import ELLIPSIS
64
65 %description -n python3-dtopt -l pl.UTF-8
66 dtopts dodaje opcje do przykładów doctest w trakcie ich działania.
67 Przy korzystaniu z modułu doctest często wygodne jest użycie opcji
68 ELLIPSIS, pozwalającej na użycie ... jako maski globalnej. Ale albo
69 trzeba konfigurować narzędzie uruchamiające do użycia tej opcji, albo
70 umieszczać "#doctest: +ELLIPSIS" przy każdym przykładzie używającym
71 tej opcji. dtopt pozwala włączyć tę opcję globalnie z poziomu doctest
72 poprzez:
73 >>> from dtopt import ELLIPSIS
74
75 %prep
76 %setup -q -n %{module}-%{version}
77
78 # Remove bundled egg info
79 %{__rm} -r *.egg-info
80
81 %build
82 %if %{with python2}
83 %py_build
84
85 %if %{with tests}
86 PYTHONPATH=$(pwd) \
87 %{__python} dtopt/tests.py
88 %endif
89 %endif
90
91 %if %{with python3}
92 %py3_build
93
94 %if 0 && %{with tests}
95 # as of 0.1, uses python2 syntax
96 PYTHONPATH=$(pwd) \
97 %{__python3} dtopt/tests.py 2>&1 | tee tests.log
98 # "one error is good"
99 grep -q ' 1 failures' tests.log
100 %endif
101 %endif
102
103 %install
104 rm -rf $RPM_BUILD_ROOT
105
106 %if %{with python2}
107 %py_install
108
109 %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/dtopt/tests.py*
110 %py_postclean
111 %endif
112
113 %if %{with python3}
114 %py3_install
115
116 %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/tests.py
117 # probably won't be compiled due to python2 syntax
118 rm -f $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/__pycache__/tests.cpython-*.py*
119 %endif
120
121 %clean
122 rm -rf $RPM_BUILD_ROOT
123
124 %files
125 %defattr(644,root,root,755)
126 %doc docs/*.txt
127 %{py_sitescriptdir}/dtopt
128 %{py_sitescriptdir}/dtopt-%{version}-py*.egg-info
129
130 %if %{with python3}
131 %files -n python3-dtopt
132 %defattr(644,root,root,755)
133 %doc docs/*.txt
134 %{py3_sitescriptdir}/dtopt
135 %{py3_sitescriptdir}/dtopt-%{version}-py*.egg-info
136 %endif
This page took 0.046811 seconds and 2 git commands to generate.