]> git.pld-linux.org Git - packages/python-cssutils.git/blob - python-cssutils.spec
- rebuild with python 3.8
[packages/python-cssutils.git] / python-cssutils.spec
1 #
2 # Conditional build:
3 %bcond_without  python2         # CPython 2.x module
4 %bcond_without  python3         # CPython 3.x module
5 %bcond_without  tests           # unit tests
6 %bcond_with     tests_net       # unit tests using network
7
8 %define         module  cssutils
9 %define         encutils_ver 0.9.8
10 Summary:        A CSS Cascading Style Sheets library for Python 2
11 Summary(pl.UTF-8):      Biblioteka CSS (Cascading Style Sheets) dla Pythona 2
12 Name:           python-%{module}
13 Version:        1.0.2
14 Release:        5
15 Epoch:          1
16 License:        LGPL v3+
17 Group:          Libraries/Python
18 Source0:        https://files.pythonhosted.org/packages/source/c/cssutils/%{module}-%{version}.tar.gz
19 # Source0-md5:  dc66d96c2d78f1687f59ac412fe9d318
20 Patch0:         %{name}-tests.patch
21 Patch1:         %{name}-mock.patch
22 URL:            http://cthedot.de/cssutils/
23 %if %{with python2}
24 BuildRequires:  python-devel >= 1:2.5
25 %{?with_tests:BuildRequires:    python-mock}
26 BuildRequires:  python-setuptools
27 %endif
28 %if %{with python3}
29 BuildRequires:  python3-2to3 >= 1:3.2
30 BuildRequires:  python3-devel >= 1:3.2
31 BuildRequires:  python3-setuptools
32 %endif
33 BuildRequires:  rpm-pythonprov
34 BuildRequires:  rpmbuild(macros) >= 1.714
35 Requires:       python-modules >= 1:2.5
36 Provides:       python-encutils = %{encutils_ver}
37 Obsoletes:      python-encutils < %{encutils_ver}
38 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39
40 %description
41 A Python package to parse and build CSS Cascading Style Sheets. Partly
42 implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.
43
44 %description -l pl.UTF-8
45 Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
46 Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
47 Level 2 CSS.
48
49 %package -n python3-%{module}
50 Summary:        A CSS Cascading Style Sheets library for Python 3
51 Summary(pl.UTF-8):      Biblioteka CSS (Cascading Style Sheets) dla Pythona 3
52 Group:          Libraries/Python
53 Requires:       python3-modules >= 1:3.2
54
55 %description -n python3-%{module}
56 A Python package to parse and build CSS Cascading Style Sheets. Partly
57 implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.
58
59 %description -n python3-%{module} -l pl.UTF-8
60 Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
61 Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
62 Level 2 CSS.
63
64 %prep
65 %setup -q -n %{module}-%{version}
66 %patch0 -p1
67 %patch1 -p1
68
69 eval $(PYTHONPATH=src python -c "from encutils import VERSION;print 'VERSION=%%s' %% VERSION")
70 if [ $VERSION != %{encutils_ver} ]; then
71         echo "Please set encutils_ver to $VERSION"
72         exit 1
73 fi
74
75 %if %{without tests_net}
76 %{__sed} -i -e 's/def test_parseUrl/def skip_parseUrl/' src/cssutils/tests/test_parse.py
77 %{__sed} -i -e 's/def test_handlers/def skip_handlers/' src/cssutils/tests/test_errorhandler.py
78 %endif
79
80 %build
81 %if %{with python2}
82 %py_build
83
84 %if %{with tests}
85 %{__python} -m unittest discover -t build-2/lib -s build-2/lib/cssutils/tests
86 %endif
87 %endif
88
89 %if %{with python3}
90 %py3_build
91
92 %if %{with tests}
93 %{__python3} -m unittest discover -t build-3/lib -s build-3/lib/cssutils/tests
94 %endif
95 %endif
96
97 %install
98 rm -rf $RPM_BUILD_ROOT
99
100 %if %{with python3}
101 %py3_install
102
103 for f in csscapture csscombine cssparse ; do
104         %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-3
105 done
106
107 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/cssutils/tests
108 %endif
109
110 %if %{with python2}
111 %py_install
112
113 for f in csscapture csscombine cssparse ; do
114         %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-2
115         ln -sf ${f}-2 $RPM_BUILD_ROOT%{_bindir}/$f
116 done
117
118 %py_postclean
119 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/cssutils/tests
120 %endif
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %if %{with python2}
126 %files
127 %defattr(644,root,root,755)
128 %doc README.txt
129 %attr(755,root,root) %{_bindir}/csscapture
130 %attr(755,root,root) %{_bindir}/csscombine
131 %attr(755,root,root) %{_bindir}/cssparse
132 %attr(755,root,root) %{_bindir}/csscapture-2
133 %attr(755,root,root) %{_bindir}/csscombine-2
134 %attr(755,root,root) %{_bindir}/cssparse-2
135 %{py_sitescriptdir}/cssutils
136 %{py_sitescriptdir}/encutils
137 %{py_sitescriptdir}/cssutils-%{version}-py*.egg-info
138 %endif
139
140 %if %{with python3}
141 %files -n python3-%{module}
142 %defattr(644,root,root,755)
143 %attr(755,root,root) %{_bindir}/csscapture-3
144 %attr(755,root,root) %{_bindir}/csscombine-3
145 %attr(755,root,root) %{_bindir}/cssparse-3
146 %{py3_sitescriptdir}/cssutils
147 %{py3_sitescriptdir}/encutils
148 %{py3_sitescriptdir}/cssutils-%{version}-py*.egg-info
149 %endif
This page took 0.095665 seconds and 3 git commands to generate.