]>
Commit | Line | Data |
---|---|---|
e02d5634 ER |
1 | # |
2 | # Conditional build: | |
d5b1a0b1 JB |
3 | %bcond_without python2 # Python 2.x module |
4 | %bcond_without python3 # Python 3.x module | |
373c09d6 | 5 | %bcond_without tests # tests run |
e02d5634 ER |
6 | |
7 | %define module mimeparse | |
d5b1a0b1 JB |
8 | Summary: Python 2.x module for parsing mime-type names |
9 | Summary(pl.UTF-8): Moduł Pythona 2.x do analizy nazw typów MIME | |
e02d5634 | 10 | Name: python-%{module} |
4cd6673c | 11 | Version: 1.6.0 |
60c089ad | 12 | Release: 5 |
e02d5634 ER |
13 | License: MIT |
14 | Group: Libraries/Python | |
bdd7b1a6 | 15 | #Source0Download: https://pypi.org/pypi/python-mimeparse/ |
4cd6673c JB |
16 | Source0: https://files.pythonhosted.org/packages/source/p/python-mimeparse/%{name}-%{version}.tar.gz |
17 | # Source0-md5: a32ae1df93be1ddb581d1c0fa124bab4 | |
18 | URL: https://github.com/dbtsai/python-mimeparse | |
19 | %if %{with python2} | |
20 | BuildRequires: python-devel >= 1:2.7 | |
21 | BuildRequires: python-setuptools | |
22 | %endif | |
23 | %if %{with python3} | |
24 | BuildRequires: python3-devel >= 1:3.2 | |
25 | BuildRequires: python3-setuptools | |
26 | %endif | |
e02d5634 | 27 | BuildRequires: rpm-pythonprov |
373c09d6 | 28 | BuildRequires: rpmbuild(macros) >= 1.714 |
e02d5634 ER |
29 | BuildArch: noarch |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
32 | %description | |
33 | This module provides basic functions for parsing mime-type names and | |
34 | matching them against a list of media-ranges. | |
35 | ||
d5b1a0b1 JB |
36 | %description -l pl.UTF-8 |
37 | Ten moduł udostępnia podstawowe funkcje do analizy nazw typów MIME | |
38 | oraz dopasowywania ich do listy zakresów mediów. | |
39 | ||
e02d5634 | 40 | %package -n python3-%{module} |
d5b1a0b1 JB |
41 | Summary: Python 3.x module for parsing mime-type names |
42 | Summary(pl.UTF-8): Moduł Pythona 3.x do analizy nazw typów MIME | |
e02d5634 ER |
43 | Group: Libraries/Python |
44 | ||
45 | %description -n python3-%{module} | |
46 | This module provides basic functions for parsing mime-type names and | |
47 | matching them against a list of media-ranges. | |
48 | ||
d5b1a0b1 JB |
49 | %description -n python3-%{module} -l pl.UTF-8 |
50 | Ten moduł udostępnia podstawowe funkcje do analizy nazw typów MIME | |
51 | oraz dopasowywania ich do listy zakresów mediów. | |
52 | ||
e02d5634 | 53 | %prep |
d5b1a0b1 | 54 | %setup -q |
e02d5634 ER |
55 | |
56 | %build | |
d5b1a0b1 | 57 | %if %{with python2} |
373c09d6 | 58 | %py_build |
e02d5634 ER |
59 | |
60 | %if %{with tests} | |
373c09d6 JB |
61 | cd build-2 |
62 | ln -sf ../testdata.json . | |
63 | %{__python} ../mimeparse_test.py | |
d5b1a0b1 JB |
64 | cd .. |
65 | %endif | |
373c09d6 | 66 | %endif |
e02d5634 ER |
67 | |
68 | %if %{with python3} | |
373c09d6 JB |
69 | %py3_build |
70 | ||
71 | %if %{with tests} | |
72 | cd build-3 | |
73 | ln -sf ../testdata.json . | |
74 | %{__python3} ../mimeparse_test.py | |
d5b1a0b1 | 75 | cd .. |
e02d5634 ER |
76 | %endif |
77 | %endif | |
78 | ||
79 | %install | |
80 | rm -rf $RPM_BUILD_ROOT | |
d5b1a0b1 JB |
81 | |
82 | %if %{with python2} | |
373c09d6 | 83 | %py_install |
e02d5634 ER |
84 | |
85 | %py_postclean | |
d5b1a0b1 | 86 | %endif |
e02d5634 ER |
87 | |
88 | %if %{with python3} | |
373c09d6 | 89 | %py3_install |
e02d5634 ER |
90 | %endif |
91 | ||
92 | %clean | |
93 | rm -rf $RPM_BUILD_ROOT | |
94 | ||
d5b1a0b1 | 95 | %if %{with python2} |
e02d5634 ER |
96 | %files |
97 | %defattr(644,root,root,755) | |
4cd6673c | 98 | %doc LICENSE README.rst |
e02d5634 | 99 | %{py_sitescriptdir}/mimeparse.py[co] |
d5b1a0b1 JB |
100 | %{py_sitescriptdir}/python_mimeparse-%{version}-py*.egg-info |
101 | %endif | |
e02d5634 ER |
102 | |
103 | %if %{with python3} | |
104 | %files -n python3-%{module} | |
105 | %defattr(644,root,root,755) | |
4cd6673c | 106 | %doc LICENSE README.rst |
e02d5634 | 107 | %{py3_sitescriptdir}/mimeparse.py |
d5b1a0b1 JB |
108 | %{py3_sitescriptdir}/__pycache__/mimeparse.*.py[co] |
109 | %{py3_sitescriptdir}/python_mimeparse-%{version}-py*.egg-info | |
e02d5634 | 110 | %endif |