]>
Commit | Line | Data |
---|---|---|
c5542f5e | 1 | # TODO: finish doc |
c0e42432 | 2 | # |
a5c4bb79 | 3 | # Conditional build: |
c5542f5e | 4 | %bcond_with doc # Sphinx documentation |
c0e42432 | 5 | %bcond_without tests # unit tests |
a5c4bb79 MK |
6 | %bcond_without python2 # CPython 2.x module |
7 | %bcond_without python3 # CPython 3.x module | |
8 | ||
9 | %define module wcwidth | |
c0e42432 JB |
10 | Summary: Measure the number of terminal column cells of wide-character codes |
11 | Summary(pl.UTF-8): Pomiar liczby kolumn terminala koniecznych do wyświetlenia znaków | |
a5c4bb79 | 12 | Name: python-%{module} |
c5542f5e | 13 | Version: 0.2.5 |
ec51a922 | 14 | Release: 2 |
a5c4bb79 MK |
15 | License: MIT |
16 | Group: Libraries/Python | |
c0e42432 JB |
17 | #Source0Download: https://github.com/jquast/wcwidth/releases |
18 | Source0: https://github.com/jquast/wcwidth/archive/%{version}/%{module}-%{version}.tar.gz | |
c5542f5e | 19 | # Source0-md5: c82382572afdbba64470f56374502952 |
c0e42432 | 20 | URL: https://pypi.org/project/wcwidth/ |
a5c4bb79 | 21 | %if %{with python2} |
c0e42432 | 22 | BuildRequires: python-modules >= 1:2.7 |
a5c4bb79 | 23 | BuildRequires: python-setuptools |
c0e42432 | 24 | %if %{with tests} |
c5542f5e | 25 | BuildRequires: python-backports.functools_lru_cache >= 1.2.1 |
c0e42432 | 26 | BuildRequires: python-pytest |
c5542f5e | 27 | BuildRequires: python-pytest-cov |
c0e42432 | 28 | %endif |
a5c4bb79 MK |
29 | %endif |
30 | %if %{with python3} | |
c0e42432 | 31 | BuildRequires: python3-modules >= 1:3.4 |
a5c4bb79 | 32 | BuildRequires: python3-setuptools |
c0e42432 JB |
33 | %if %{with tests} |
34 | BuildRequires: python3-pytest | |
c5542f5e | 35 | BuildRequires: python3-pytest-cov |
a5c4bb79 | 36 | %endif |
c0e42432 JB |
37 | %endif |
38 | BuildRequires: rpm-pythonprov | |
39 | BuildRequires: rpmbuild(macros) >= 1.714 | |
c5542f5e JB |
40 | %if %{with doc} |
41 | BuildRequires: python3-sphinx-paramlinks | |
42 | BuildRequires: python3-sphinx_rtd_theme | |
43 | BuildRequires: python3-sphinxcontrib-manpage | |
44 | BuildRequires: sphinx-pdg-3 | |
45 | %endif | |
c0e42432 | 46 | Requires: python-modules >= 1:2.7 |
a5c4bb79 MK |
47 | BuildArch: noarch |
48 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
49 | ||
50 | %description | |
c0e42432 | 51 | This library is mainly for those implementing a Terminal Emulator, or |
a5c4bb79 MK |
52 | programs that carefully produce output to be interpreted by one. |
53 | ||
c0e42432 JB |
54 | %description -l pl.UTF-8 |
55 | Ta biblioteka przydaje się głównie implementującym emulator terminala | |
56 | lub programom uważnie tworzących wyjście do interpretowania przez | |
57 | takowy. | |
a5c4bb79 MK |
58 | |
59 | %package -n python3-%{module} | |
c0e42432 JB |
60 | Summary: Measure the number of terminal column cells of wide-character codes |
61 | Summary(pl.UTF-8): Pomiar liczby kolumn terminala koniecznych do wyświetlenia znaków | |
a5c4bb79 | 62 | Group: Libraries/Python |
c0e42432 | 63 | Requires: python3-modules >= 1:3.4 |
a5c4bb79 MK |
64 | |
65 | %description -n python3-%{module} | |
c0e42432 | 66 | This library is mainly for those implementing a Terminal Emulator, or |
a5c4bb79 MK |
67 | programs that carefully produce output to be interpreted by one. |
68 | ||
c0e42432 JB |
69 | %description -n python3-%{module} -l pl.UTF-8 |
70 | Ta biblioteka przydaje się głównie implementującym emulator terminala | |
71 | lub programom uważnie tworzących wyjście do interpretowania przez | |
72 | takowy. | |
a5c4bb79 MK |
73 | |
74 | %prep | |
75 | %setup -q -n %{module}-%{version} | |
76 | ||
a5c4bb79 MK |
77 | %build |
78 | %if %{with python2} | |
c0e42432 JB |
79 | %py_build |
80 | ||
81 | %if %{with tests} | |
c5542f5e JB |
82 | # test_package_version refers to distribution, fails without installed package |
83 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
84 | PYTEST_PLUGINS=pytest_cov.plugin \ | |
85 | PYTHONPATH=$(pwd) \ | |
86 | %{__python} -m pytest tests -k 'not test_package_version' | |
c0e42432 | 87 | %endif |
a5c4bb79 MK |
88 | %endif |
89 | ||
90 | %if %{with python3} | |
c0e42432 | 91 | %py3_build |
a5c4bb79 | 92 | |
c0e42432 | 93 | %if %{with tests} |
c5542f5e JB |
94 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
95 | PYTEST_PLUGINS=pytest_cov.plugin \ | |
96 | PYTHONPATH=$(pwd) \ | |
97 | %{__python3} -m pytest tests -k 'not test_package_version' | |
98 | %endif | |
c0e42432 | 99 | %endif |
c5542f5e JB |
100 | |
101 | %if %{with doc} | |
102 | sphinx-build-3 -b html docs docs/build/html | |
a5c4bb79 MK |
103 | %endif |
104 | ||
105 | %install | |
106 | rm -rf $RPM_BUILD_ROOT | |
107 | ||
108 | %if %{with python2} | |
109 | %py_install | |
110 | ||
a5c4bb79 MK |
111 | %py_postclean |
112 | %endif | |
113 | ||
114 | %if %{with python3} | |
115 | %py3_install | |
c0e42432 | 116 | %endif |
a5c4bb79 MK |
117 | |
118 | %clean | |
119 | rm -rf $RPM_BUILD_ROOT | |
120 | ||
121 | %if %{with python2} | |
122 | %files | |
123 | %defattr(644,root,root,755) | |
c5542f5e | 124 | %doc LICENSE README.rst |
c0e42432 | 125 | %{py_sitescriptdir}/wcwidth |
c5542f5e | 126 | %{py_sitescriptdir}/wcwidth-%{version}-py*.egg-info |
a5c4bb79 MK |
127 | %endif |
128 | ||
129 | %if %{with python3} | |
130 | %files -n python3-%{module} | |
131 | %defattr(644,root,root,755) | |
c5542f5e | 132 | %doc LICENSE README.rst |
c0e42432 | 133 | %{py3_sitescriptdir}/wcwidth |
c5542f5e | 134 | %{py3_sitescriptdir}/wcwidth-%{version}-py*.egg-info |
a5c4bb79 | 135 | %endif |