]>
Commit | Line | Data |
---|---|---|
2f3fc4cd ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # don't build doc | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module rjsmin | |
8 | %define egg_name rjsmin | |
9 | %define pypi_name rjsmin | |
10 | Summary: rJSmin is a JavaScript minifier written in Python | |
11 | Name: python-%{pypi_name} | |
12 | Version: 1.0.12 | |
93c71614 | 13 | Release: 8 |
2f3fc4cd ER |
14 | License: Apache v2.0 |
15 | Group: Libraries/Python | |
16 | Source0: https://pypi.python.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz | |
17 | # Source0-md5: 9f67e133c88df5497d3da847603da9bf | |
18 | URL: http://opensource.perlig.de/rjsmin/ | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-modules | |
23 | BuildRequires: python-setuptools | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-modules | |
27 | BuildRequires: python3-setuptools | |
28 | %endif | |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
30 | ||
31 | %description | |
32 | The minifier is based on the semantics of jsmin.c by Douglas | |
33 | Crockford. | |
34 | ||
35 | The module is a re-implementation aiming for speed, so it can be used | |
36 | at runtime (rather than during a preprocessing step). Usually it | |
37 | produces the same results as the original jsmin.c. | |
38 | ||
39 | %package -n python3-%{pypi_name} | |
40 | Summary: rJSmin is a JavaScript minifier written in Python | |
41 | Group: Libraries/Python | |
42 | ||
43 | %description -n python3-%{pypi_name} | |
44 | The minifier is based on the semantics of jsmin.c by Douglas | |
45 | Crockford. | |
46 | ||
47 | The module is a re-implementation aiming for speed, so it can be used | |
48 | at runtime (rather than during a preprocessing step). Usually it | |
49 | produces the same results as the original jsmin.c. | |
50 | ||
51 | %package apidocs | |
52 | Summary: Javascript Minifier - docs | |
53 | Group: Documentation | |
2f3fc4cd | 54 | BuildArch: noarch |
2f3fc4cd ER |
55 | |
56 | %description apidocs | |
57 | Docs for rJSmin | |
58 | ||
59 | %prep | |
60 | %setup -q -n %{pypi_name}-%{version} | |
61 | ||
62 | # strip bang path from rjsmin.py | |
63 | sed -i '1d' rjsmin.py | |
64 | ||
65 | %build | |
66 | %if %{with python2} | |
67 | %py_build | |
68 | %endif | |
69 | ||
70 | %if %{with python3} | |
71 | %py3_build | |
72 | %endif | |
73 | ||
74 | %install | |
75 | rm -rf $RPM_BUILD_ROOT | |
76 | %if %{with python2} | |
77 | %py_install | |
78 | %py_postclean | |
79 | %endif | |
80 | ||
81 | %if %{with python3} | |
82 | %py3_install | |
83 | %endif | |
84 | ||
85 | rm -r $RPM_BUILD_ROOT%{_docdir}/%{module} | |
86 | ||
87 | %clean | |
88 | rm -rf $RPM_BUILD_ROOT | |
89 | ||
90 | %if %{with python2} | |
91 | %files | |
92 | %defattr(644,root,root,755) | |
93 | %doc README.rst LICENSE | |
94 | %{py_sitedir}/%{module}.py[co] | |
95 | %attr(755,root,root) %{py_sitedir}/_%{module}.so | |
96 | %{py_sitedir}/%{pypi_name}-%{version}-py*.egg-info | |
97 | %endif | |
98 | ||
99 | %if %{with python3} | |
100 | %files -n python3-%{pypi_name} | |
101 | %defattr(644,root,root,755) | |
102 | %doc README.rst LICENSE | |
103 | %{py3_sitedir}/%{module}.py | |
104 | %{py3_sitedir}/__pycache__/%{module}.*.pyc | |
105 | %attr(755,root,root) %{py3_sitedir}/_%{module}.*.so | |
106 | %{py3_sitedir}/%{egg_name}-%{version}-py*.egg-info | |
107 | %endif | |
108 | ||
109 | %if %{with doc} | |
110 | %files apidocs | |
111 | %defattr(644,root,root,755) | |
112 | %doc README.rst docs | |
113 | %endif |