]> git.pld-linux.org Git - packages/python-pycountry.git/blob - python-pycountry.spec
a5c7c0fde961f269c7c49b43db5512a76af0f851
[packages/python-pycountry.git] / python-pycountry.spec
1 #
2 # Conditional build:
3 %bcond_without  tests   # unit tests
4 %bcond_without  python2 # CPython 2.x module
5 %bcond_without  python3 # CPython 3.x module
6
7 Summary:        ISO country, subdivision, language, currency and script definitions and their translations
8 Summary(pl.UTF-8):      Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z tłumaczeniami
9 Name:           python-pycountry
10 # keep 18.x here for python2 support
11 Version:        18.12.8
12 Release:        1
13 License:        LGPL v2.1
14 Group:          Libraries/Python
15 #Source0Download: https://pypi.org/simple/pycountry/
16 Source0:        https://files.pythonhosted.org/packages/source/p/pycountry/pycountry-%{version}.tar.gz
17 # Source0-md5:  46223fa49c45c304083de7d5b1870fb7
18 URL:            https://pypi.org/project/pycountry/
19 %if %{with python2}
20 BuildRequires:  python-modules >= 1:2.6
21 BuildRequires:  python-setuptools
22 %if %{with tests}
23 BuildRequires:  python-pytest
24 %endif
25 %endif
26 %if %{with python3}
27 BuildRequires:  python3-modules >= 1:3.3
28 BuildRequires:  python3-setuptools
29 %if %{with tests}
30 BuildRequires:  python3-pytest
31 %endif
32 %endif
33 BuildRequires:  rpm-pythonprov
34 BuildRequires:  rpmbuild(macros) >= 1.714
35 Requires:       python-modules >= 1:2.6
36 BuildArch:      noarch
37 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38
39 %description
40 ISO country, subdivision, language, currency and script definitions
41 and their translations.
42
43 %description -l pl.UTF-8
44 Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z
45 tłumaczeniami.
46
47 %package -n python3-pycountry
48 Summary:        ISO country, subdivision, language, currency and script definitions and their translations
49 Summary(pl.UTF-8):      Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z tłumaczeniami
50 Group:          Libraries/Python
51 Requires:       python3-modules >= 1:3.3
52
53 %description -n python3-pycountry
54 ISO country, subdivision, language, currency and script definitions
55 and their translations.
56
57 %description -n python3-pycountry -l pl.UTF-8
58 Definicje ISO dla krajów, podziału, języków, walut i pisma wraz z
59 tłumaczeniami.
60
61 %prep
62 %setup -q -n pycountry-%{version}
63
64 %build
65 %if %{with python2}
66 %py_build
67
68 %if %{with tests}
69 PYTHONPATH=$(pwd)/src \
70 %{__python} -m pytest src/pycountry/tests
71 %endif
72 %endif
73
74 %if %{with python3}
75 %py3_build
76
77 %if %{with tests}
78 PYTHONPATH=$(pwd)/src \
79 %{__python3} -m pytest src/pycountry/tests
80 %endif
81 %endif
82
83 %install
84 rm -rf $RPM_BUILD_ROOT
85
86 %if %{with python2}
87 %py_install
88
89 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/pycountry/tests
90 %py_postclean
91
92 find $RPM_BUILD_ROOT%{py_sitescriptdir}/pycountry/locales -type d -maxdepth 1 | \
93         %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*locales/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py2.lang
94 %endif
95
96 %if %{with python3}
97 %py3_install
98
99 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/pycountry/tests
100
101 find $RPM_BUILD_ROOT%{py3_sitescriptdir}/pycountry/locales -type d -maxdepth 1 | \
102         %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*locales/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang
103 %endif
104
105 %clean
106 rm -rf $RPM_BUILD_ROOT
107
108 %if %{with python2}
109 %files -f py2.lang
110 %defattr(644,root,root,755)
111 %doc HISTORY.txt README TODO.txt
112 %dir %{py_sitescriptdir}/pycountry
113 %{py_sitescriptdir}/pycountry/*.py[co]
114 %{py_sitescriptdir}/pycountry/databases
115 %dir %{py_sitescriptdir}/pycountry/locales
116 %{py_sitescriptdir}/pycountry-%{version}-py*.egg-info
117 %endif
118
119 %if %{with python3}
120 %files -n python3-pycountry -f py3.lang
121 %defattr(644,root,root,755)
122 %doc HISTORY.txt README TODO.txt
123 %dir %{py3_sitescriptdir}/pycountry
124 %{py3_sitescriptdir}/pycountry/*.py
125 %{py3_sitescriptdir}/pycountry/__pycache__
126 %{py3_sitescriptdir}/pycountry/databases
127 %dir %{py3_sitescriptdir}/pycountry/locales
128 %{py3_sitescriptdir}/pycountry-%{version}-py*.egg-info
129 %endif
This page took 0.091811 seconds and 2 git commands to generate.