]> git.pld-linux.org Git - SPECS.git/blob - python-pycountry.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / python-pycountry.spec
1 # NOTE: for versions 19+ for Python 3.3+ see python3-pycountry.spec
2 #
3 # Conditional build:
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)
7
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
12 Version:        18.12.8
13 Release:        1
14 License:        LGPL v2.1
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/
20 %if %{with python2}
21 BuildRequires:  python-modules >= 1:2.6
22 BuildRequires:  python-setuptools
23 %if %{with tests}
24 BuildRequires:  python-pytest
25 %endif
26 %endif
27 %if %{with python3}
28 BuildRequires:  python3-modules >= 1:3.3
29 BuildRequires:  python3-setuptools
30 %if %{with tests}
31 BuildRequires:  python3-pytest
32 %endif
33 %endif
34 BuildRequires:  rpm-pythonprov
35 BuildRequires:  rpmbuild(macros) >= 1.714
36 Requires:       python-modules >= 1:2.6
37 BuildArch:      noarch
38 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39
40 %description
41 ISO country, subdivision, language, currency and script definitions
42 and their translations.
43
44 %description -l pl.UTF-8
45 Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z
46 tłumaczeniami.
47
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
53
54 %description -n python3-pycountry
55 ISO country, subdivision, language, currency and script definitions
56 and their translations.
57
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
60 tłumaczeniami.
61
62 %prep
63 %setup -q -n pycountry-%{version}
64
65 %build
66 %if %{with python2}
67 %py_build
68
69 %if %{with tests}
70 PYTHONPATH=$(pwd)/src \
71 %{__python} -m pytest src/pycountry/tests
72 %endif
73 %endif
74
75 %if %{with python3}
76 %py3_build
77
78 %if %{with tests}
79 PYTHONPATH=$(pwd)/src \
80 %{__python3} -m pytest src/pycountry/tests
81 %endif
82 %endif
83
84 %install
85 rm -rf $RPM_BUILD_ROOT
86
87 %if %{with python2}
88 %py_install
89
90 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/pycountry/tests
91 %py_postclean
92
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
95 %endif
96
97 %if %{with python3}
98 %py3_install
99
100 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/pycountry/tests
101
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
104 %endif
105
106 %clean
107 rm -rf $RPM_BUILD_ROOT
108
109 %if %{with python2}
110 %files -f py2.lang
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
118 %endif
119
120 %if %{with python3}
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
130 %endif
This page took 0.394426 seconds and 3 git commands to generate.