]>
Commit | Line | Data |
---|---|---|
4403ea8e | 1 | # |
e0a16c9e JB |
2 | # Conditional build: |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
31581d00 | 5 | %bcond_with tests # py.test tests [require ptys, so not on builders] |
e0a16c9e JB |
6 | %bcond_without doc # Sphinx documentation |
7 | ||
d848af59 | 8 | %define module pexpect |
e0a16c9e JB |
9 | Summary: Pure Python Expect-like module |
10 | Summary(pl.UTF-8): Moduł podobny do narzędzia Expect napisany w czystym Pythonie | |
d848af59 | 11 | Name: python-%{module} |
99b610e7 | 12 | Version: 4.8.0 |
bf331c3e | 13 | Release: 3 |
e0a16c9e | 14 | License: ISC |
d848af59 | 15 | Group: Development/Languages/Python |
4403ea8e JB |
16 | #Source0Download: https://pypi.org/simple/pexpect/ |
17 | Source0: https://files.pythonhosted.org/packages/source/p/pexpect/pexpect-%{version}.tar.gz | |
99b610e7 JB |
18 | # Source0-md5: 153eb25184249d6a85fde9acf4804085 |
19 | Patch0: %{name}-use_setuptools.patch | |
bf331c3e | 20 | Patch1: sphinx-api.patch |
e0a16c9e | 21 | URL: http://pexpect.readthedocs.io/ |
4403ea8e | 22 | %if %{with tests} && %(locale -a | grep -q '^C\.utf8$'; echo $?) |
e0a16c9e JB |
23 | BuildRequires: glibc-localedb-all |
24 | %endif | |
25 | %if %{with python2} | |
26 | BuildRequires: python-devel >= 1:2.7 | |
27 | BuildRequires: python-modules >= 1:2.7 | |
99b610e7 | 28 | BuildRequires: python-setuptools |
e0a16c9e JB |
29 | %if %{with tests} |
30 | BuildRequires: python-ptyprocess >= 0.5 | |
31 | BuildRequires: python-pytest | |
32 | %endif | |
33 | %endif | |
34 | %if %{with python3} | |
35 | BuildRequires: python3-modules >= 1:3.2 | |
99b610e7 | 36 | BuildRequires: python3-setuptools |
e0a16c9e JB |
37 | %if %{with tests} |
38 | BuildRequires: python3-ptyprocess >= 0.5 | |
39 | BuildRequires: python3-pytest | |
40 | %endif | |
41 | %endif | |
2f08e3cd | 42 | BuildRequires: rpm-pythonprov |
e0a16c9e JB |
43 | BuildRequires: rpmbuild(macros) >= 1.714 |
44 | %if %{with doc} | |
45 | BuildRequires: sphinx-pdg | |
46 | %endif | |
47 | Requires: python-modules >= 1:2.7 | |
176f3d72 | 48 | BuildArch: noarch |
d848af59 | 49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
50 | ||
51 | %description | |
ae11350e JB |
52 | Pexpect is a pure Python module for spawning child applications; |
53 | controlling them; and responding to expected patterns in their output. | |
54 | Pexpect works like Don Libes' Expect. Pexpect allows your script to | |
55 | spawn a child application and control it as if a human were typing | |
56 | commands. | |
d848af59 | 57 | |
355748ac JR |
58 | %description -l pl.UTF-8 |
59 | Pexpect jest modułem napisanym wyłącznie w Pythonie przeznaczonym do | |
ae11350e | 60 | uruchamiania aplikacji i kontroli nad nimi poprzez reagowanie na |
355748ac JR |
61 | znalezione wzorce na ich wyjściu. Pexpect działa podobnie do Expecta |
62 | Dona Libesa - pozwala skryptom z ich poziomu uruchomić inne programy i | |
63 | sprawować nad nimi kontrolę imitując interakcję użytkownika. | |
d848af59 | 64 | |
e0a16c9e JB |
65 | %package -n python3-%{module} |
66 | Summary: Pure Python Expect-like module | |
67 | Summary(pl.UTF-8): Moduł podobny do narzędzia Expect napisany w czystym Pythonie | |
68 | Group: Development/Languages/Python | |
69 | Requires: python3-modules >= 1:3.2 | |
70 | ||
71 | %description -n python3-%{module} | |
72 | Pexpect is a pure Python module for spawning child applications; | |
73 | controlling them; and responding to expected patterns in their output. | |
74 | Pexpect works like Don Libes' Expect. Pexpect allows your script to | |
75 | spawn a child application and control it as if a human were typing | |
76 | commands. | |
77 | ||
78 | %description -n python3-%{module} -l pl.UTF-8 | |
79 | Pexpect jest modułem napisanym wyłącznie w Pythonie przeznaczonym do | |
80 | uruchamiania aplikacji i kontroli nad nimi poprzez reagowanie na | |
81 | znalezione wzorce na ich wyjściu. Pexpect działa podobnie do Expecta | |
82 | Dona Libesa - pozwala skryptom z ich poziomu uruchomić inne programy i | |
83 | sprawować nad nimi kontrolę imitując interakcję użytkownika. | |
84 | ||
85 | %package apidocs | |
86 | Summary: Documentation for Python pexpect module | |
87 | Summary(pl.UTF-8): Dokumentacja do modułu Pythona pexpect | |
88 | Group: Documentation | |
89 | ||
90 | %description apidocs | |
91 | Documentation for Python pexpect module. | |
92 | ||
93 | %description apidocs -l pl.UTF-8 | |
94 | Dokumentacja do modułu Pythona pexpect. | |
95 | ||
d848af59 | 96 | %prep |
31a995b3 | 97 | %setup -q -n %{module}-%{version} |
99b610e7 | 98 | %patch0 -p1 |
bf331c3e | 99 | %patch1 -p1 |
d848af59 | 100 | |
101 | %build | |
e0a16c9e | 102 | %if %{with python2} |
8046176b | 103 | %py_build |
d848af59 | 104 | |
99b610e7 JB |
105 | %if %{with tests} |
106 | # FSM test fails with python 2 because of redirected output(?) | |
107 | LC_ALL=C.UTF-8 \ | |
108 | %{__python} -m pytest -k 'not test_run_fsm' tests | |
109 | %endif | |
e0a16c9e JB |
110 | %endif |
111 | ||
112 | %if %{with python3} | |
113 | %py3_build | |
114 | ||
99b610e7 JB |
115 | %if %{with tests} |
116 | LC_ALL=C.UTF-8 \ | |
117 | %{__python3} -m pytest tests | |
118 | %endif | |
e0a16c9e JB |
119 | %endif |
120 | ||
121 | %if %{with doc} | |
122 | %{__make} -C doc html | |
123 | %endif | |
124 | ||
d848af59 | 125 | %install |
126 | rm -rf $RPM_BUILD_ROOT | |
e0a16c9e JB |
127 | |
128 | %if %{with python2} | |
8046176b | 129 | %py_install |
d848af59 | 130 | |
e0a16c9e JB |
131 | %py_postclean |
132 | ||
133 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/pexpect/bashrc.sh | |
134 | ||
d380a37f | 135 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
e0a16c9e | 136 | cp -p examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
88d6cbde JB |
137 | %{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/*.py |
138 | %{__sed} -i -e '1s,/usr/bin/python,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/cgishell.cgi | |
139 | %{__sed} -i -e '2s,/usr/bin/env python,,' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/cgishell.cgi | |
e0a16c9e | 140 | %endif |
f575ff11 | 141 | |
e0a16c9e JB |
142 | %if %{with python3} |
143 | %py3_install | |
144 | ||
145 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/pexpect/bashrc.sh | |
146 | ||
147 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
148 | cp -p examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
cd1b1f58 JB |
149 | %{__sed} -i -e '1s,/usr/bin/env python,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/*.py |
150 | %{__sed} -i -e '1s,/usr/bin/python,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/cgishell.cgi | |
151 | %{__sed} -i -e '2s,/usr/bin/env python,,' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/cgishell.cgi | |
e0a16c9e | 152 | %endif |
d848af59 | 153 | |
154 | %clean | |
155 | rm -rf $RPM_BUILD_ROOT | |
156 | ||
e0a16c9e | 157 | %if %{with python2} |
d848af59 | 158 | %files |
159 | %defattr(644,root,root,755) | |
e0a16c9e JB |
160 | %doc LICENSE README.rst |
161 | %{py_sitescriptdir}/pexpect | |
d380a37f | 162 | %{py_sitescriptdir}/pexpect-%{version}-py*.egg-info |
f575ff11 | 163 | %{_examplesdir}/%{name}-%{version} |
e0a16c9e JB |
164 | %endif |
165 | ||
166 | %if %{with python3} | |
167 | %files -n python3-%{module} | |
168 | %defattr(644,root,root,755) | |
169 | %doc LICENSE README.rst | |
170 | %{py3_sitescriptdir}/pexpect | |
171 | %{py3_sitescriptdir}/pexpect-%{version}-py*.egg-info | |
172 | %{_examplesdir}/python3-%{module}-%{version} | |
173 | %endif | |
174 | ||
175 | %if %{with doc} | |
176 | %files apidocs | |
177 | %defattr(644,root,root,755) | |
178 | %doc doc/_build/html/{_static,api,*.html,*.js} | |
179 | %endif |