]>
Commit | Line | Data |
---|---|---|
594e088e JB |
1 | # NOTE: original package name is python-magic, but it would conflict with |
2 | # python*-magic packages built from file.spec. | |
3 | # Also, we rename magic.py to magic_ahupp.py to avoid import name conflict. | |
4 | # | |
5 | # Conditional build: | |
6 | %bcond_with tests # unit tests (broken, magic._pyc_ file is missing in sources) | |
7 | %bcond_without python2 # CPython 2.x module | |
8 | %bcond_without python3 # CPython 3.x module | |
9 | ||
10 | Summary: File type identification using libmagic | |
11 | Summary(pl.UTF-8): Identyfikacja typu pliku przy użyciu libmagic | |
12 | Name: python-magic_ahupp | |
13 | Version: 0.4.15 | |
eaa2312e | 14 | Release: 4 |
594e088e JB |
15 | License: MIT |
16 | Group: Libraries/Python | |
17 | #Source0Download: https://pypi.org/simple/python-magic/ | |
18 | Source0: https://files.pythonhosted.org/packages/source/p/python-magic/python-magic-%{version}.tar.gz | |
19 | # Source0-md5: e384c95a47218f66c6501cd6dd45ff59 | |
20 | URL: http://github.com/ahupp/python-magic | |
21 | %if %{with tests} | |
22 | BuildRequires: libmagic | |
23 | %endif | |
24 | %if %{with python2} | |
25 | BuildRequires: python-modules >= 1:2.7 | |
26 | BuildRequires: python-setuptools | |
27 | %endif | |
28 | %if %{with python3} | |
29 | BuildRequires: python3-modules >= 1:3.6 | |
30 | BuildRequires: python3-setuptools | |
31 | %endif | |
32 | BuildRequires: rpm-pythonprov | |
33 | BuildRequires: rpmbuild(macros) >= 1.714 | |
34 | Requires: libmagic | |
35 | Requires: python-modules >= 1:2.7 | |
36 | BuildArch: noarch | |
37 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
38 | ||
39 | %description | |
40 | This module uses ctypes to access the libmagic file type | |
41 | identification library. It makes use of the local magic database and | |
42 | supports both textual and MIME-type output. | |
43 | ||
44 | %description -l pl.UTF-8 | |
45 | Ten moduł wykorzystuje ctypes do dostępu do biblioteki identyfikacji | |
46 | typów plików libmagic. Wykorzystuje lokalną bazę danych wartości | |
47 | magicznych i obsługuje wyjście zarówno w postaci tekstu, jak i typów | |
48 | MIME. | |
49 | ||
50 | %package -n python3-magic_ahupp | |
51 | Summary: File type identification using libmagic | |
52 | Summary(pl.UTF-8): Identyfikacja typu pliku przy użyciu libmagic | |
53 | Group: Libraries/Python | |
54 | Requires: libmagic | |
55 | Requires: python3-modules >= 1:3.6 | |
56 | ||
57 | %description -n python3-magic_ahupp | |
58 | This module uses ctypes to access the libmagic file type | |
59 | identification library. It makes use of the local magic database and | |
60 | supports both textual and MIME-type output. | |
61 | ||
62 | %description -n python3-magic_ahupp -l pl.UTF-8 | |
63 | Ten moduł wykorzystuje ctypes do dostępu do biblioteki identyfikacji | |
64 | typów plików libmagic. Wykorzystuje lokalną bazę danych wartości | |
65 | magicznych i obsługuje wyjście zarówno w postaci tekstu, jak i typów | |
66 | MIME. | |
67 | ||
68 | %prep | |
69 | %setup -q -n python-magic-%{version} | |
70 | ||
71 | %build | |
72 | %if %{with python2} | |
73 | %py_build | |
74 | ||
75 | %if %{with tests} | |
76 | LC_ALL=C.UTF-8 %{__python} -m unittest discover -s test | |
77 | %endif | |
78 | %endif | |
79 | ||
80 | %if %{with python3} | |
81 | %py3_build | |
82 | ||
83 | %if %{with tests} | |
84 | LC_ALL=C.UTF-8 %{__python3} -m unittest discover -s test | |
85 | %endif | |
86 | %endif | |
87 | ||
88 | %install | |
89 | rm -rf $RPM_BUILD_ROOT | |
90 | ||
91 | %if %{with python2} | |
92 | %py_install | |
93 | ||
94 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/magic.py[co] | |
95 | %{__mv} $RPM_BUILD_ROOT%{py_sitescriptdir}/{magic,magic_ahupp}.py | |
96 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
97 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
98 | %py_postclean | |
99 | %endif | |
100 | ||
101 | %if %{with python3} | |
102 | %py3_install | |
103 | ||
104 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/__pycache__/*.py[co] | |
105 | %{__mv} $RPM_BUILD_ROOT%{py3_sitescriptdir}/{magic,magic_ahupp}.py | |
106 | %py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
107 | %py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
108 | %endif | |
109 | ||
110 | %clean | |
111 | rm -rf $RPM_BUILD_ROOT | |
112 | ||
113 | %if %{with python2} | |
114 | %files | |
115 | %defattr(644,root,root,755) | |
116 | %doc LICENSE | |
117 | %{py_sitescriptdir}/magic_ahupp.py[co] | |
118 | %{py_sitescriptdir}/python_magic-%{version}-py*.egg-info | |
119 | %endif | |
120 | ||
121 | %if %{with python3} | |
122 | %files -n python3-magic_ahupp | |
123 | %defattr(644,root,root,755) | |
124 | %doc LICENSE | |
125 | %{py3_sitescriptdir}/magic_ahupp.py | |
126 | %{py3_sitescriptdir}/__pycache__/magic_ahupp.cpython-*.py[co] | |
127 | %{py3_sitescriptdir}/python_magic-%{version}-py*.egg-info | |
128 | %endif |