1 # NOTE: for versions 19+ for Python 3.3+ see python3-pycountry.spec
4 %bcond_without tests # unit tests
5 %bcond_without python2 # CPython 2.x module
6 %bcond_with python3 # CPython 3.x module (built from python3-pycountry.spec)
8 Summary: ISO country, subdivision, language, currency and script definitions and their translations
9 Summary(pl.UTF-8): Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z tłumaczeniami
10 Name: python-pycountry
11 # keep 18.x here for python2 support
15 Group: Libraries/Python
16 #Source0Download: https://pypi.org/simple/pycountry/
17 Source0: https://files.pythonhosted.org/packages/source/p/pycountry/pycountry-%{version}.tar.gz
18 # Source0-md5: 46223fa49c45c304083de7d5b1870fb7
19 URL: https://pypi.org/project/pycountry/
21 BuildRequires: python-modules >= 1:2.6
22 BuildRequires: python-setuptools
24 BuildRequires: python-pytest
28 BuildRequires: python3-modules >= 1:3.3
29 BuildRequires: python3-setuptools
31 BuildRequires: python3-pytest
34 BuildRequires: rpm-pythonprov
35 BuildRequires: rpmbuild(macros) >= 1.714
36 Requires: python-modules >= 1:2.6
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 ISO country, subdivision, language, currency and script definitions
42 and their translations.
44 %description -l pl.UTF-8
45 Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z
48 %package -n python3-pycountry
49 Summary: ISO country, subdivision, language, currency and script definitions and their translations
50 Summary(pl.UTF-8): Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z tłumaczeniami
51 Group: Libraries/Python
52 Requires: python3-modules >= 1:3.3
54 %description -n python3-pycountry
55 ISO country, subdivision, language, currency and script definitions
56 and their translations.
58 %description -n python3-pycountry -l pl.UTF-8
59 Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z
63 %setup -q -n pycountry-%{version}
70 PYTHONPATH=$(pwd)/src \
71 %{__python} -m pytest src/pycountry/tests
79 PYTHONPATH=$(pwd)/src \
80 %{__python3} -m pytest src/pycountry/tests
85 rm -rf $RPM_BUILD_ROOT
90 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/pycountry/tests
93 find $RPM_BUILD_ROOT%{py_sitescriptdir}/pycountry/locales -type d -maxdepth 1 | \
94 %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*locales/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py2.lang
100 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/pycountry/tests
102 find $RPM_BUILD_ROOT%{py3_sitescriptdir}/pycountry/locales -type d -maxdepth 1 | \
103 %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*locales/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang
107 rm -rf $RPM_BUILD_ROOT
111 %defattr(644,root,root,755)
112 %doc HISTORY.txt README TODO.txt
113 %dir %{py_sitescriptdir}/pycountry
114 %{py_sitescriptdir}/pycountry/*.py[co]
115 %{py_sitescriptdir}/pycountry/databases
116 %dir %{py_sitescriptdir}/pycountry/locales
117 %{py_sitescriptdir}/pycountry-%{version}-py*.egg-info
121 %files -n python3-pycountry -f py3.lang
122 %defattr(644,root,root,755)
123 %doc HISTORY.txt README TODO.txt
124 %dir %{py3_sitescriptdir}/pycountry
125 %{py3_sitescriptdir}/pycountry/*.py
126 %{py3_sitescriptdir}/pycountry/__pycache__
127 %{py3_sitescriptdir}/pycountry/databases
128 %dir %{py3_sitescriptdir}/pycountry/locales
129 %{py3_sitescriptdir}/pycountry-%{version}-py*.egg-info