]> git.pld-linux.org Git - packages/python-cssutils.git/blob - python-cssutils.spec
83e5962eb18612049a67832dd362371c195c9f40
[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:        8
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 BuildArch:      noarch
39 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40
41 %description
42 A Python package to parse and build CSS Cascading Style Sheets. Partly
43 implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.
44
45 %description -l pl.UTF-8
46 Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
47 Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
48 Level 2 CSS.
49
50 %package -n python3-%{module}
51 Summary:        A CSS Cascading Style Sheets library for Python 3
52 Summary(pl.UTF-8):      Biblioteka CSS (Cascading Style Sheets) dla Pythona 3
53 Group:          Libraries/Python
54 Requires:       python3-modules >= 1:3.2
55
56 %description -n python3-%{module}
57 A Python package to parse and build CSS Cascading Style Sheets. Partly
58 implements the DOM Level 2 Stylesheets and DOM Level 2 CSS interfaces.
59
60 %description -n python3-%{module} -l pl.UTF-8
61 Pakiet Pythona do analizy i tworzenia CSS (Cascading Style Sheets).
62 Częściowo implementuje interfejsy DOM Level 2 Stylesheets oraz DOM
63 Level 2 CSS.
64
65 %prep
66 %setup -q -n %{module}-%{version}
67 %patch0 -p1
68 %patch1 -p1
69
70 eval $(PYTHONPATH=src python -c "from encutils import VERSION;print 'VERSION=%%s' %% VERSION")
71 if [ $VERSION != %{encutils_ver} ]; then
72         echo "Please set encutils_ver to $VERSION"
73         exit 1
74 fi
75
76 %if %{without tests_net}
77 %{__sed} -i -e 's/def test_parseUrl/def skip_parseUrl/' src/cssutils/tests/test_parse.py
78 %{__sed} -i -e 's/def test_handlers/def skip_handlers/' src/cssutils/tests/test_errorhandler.py
79 %endif
80
81 %build
82 %if %{with python2}
83 %py_build
84
85 %if %{with tests}
86 %{__python} -m unittest discover -t build-2/lib -s build-2/lib/cssutils/tests
87 %endif
88 %endif
89
90 %if %{with python3}
91 %py3_build
92
93 %if %{with tests}
94 %{__python3} -m unittest discover -t build-3/lib -s build-3/lib/cssutils/tests
95 %endif
96 %endif
97
98 %install
99 rm -rf $RPM_BUILD_ROOT
100
101 %if %{with python3}
102 %py3_install
103
104 for f in csscapture csscombine cssparse ; do
105         %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-3
106 done
107
108 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/cssutils/tests
109 %endif
110
111 %if %{with python2}
112 %py_install
113
114 for f in csscapture csscombine cssparse ; do
115         %{__mv} $RPM_BUILD_ROOT%{_bindir}/$f $RPM_BUILD_ROOT%{_bindir}/${f}-2
116         ln -sf ${f}-2 $RPM_BUILD_ROOT%{_bindir}/$f
117 done
118
119 %py_postclean
120 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/cssutils/tests
121 %endif
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126 %if %{with python2}
127 %files
128 %defattr(644,root,root,755)
129 %doc README.txt
130 %attr(755,root,root) %{_bindir}/csscapture
131 %attr(755,root,root) %{_bindir}/csscombine
132 %attr(755,root,root) %{_bindir}/cssparse
133 %attr(755,root,root) %{_bindir}/csscapture-2
134 %attr(755,root,root) %{_bindir}/csscombine-2
135 %attr(755,root,root) %{_bindir}/cssparse-2
136 %{py_sitescriptdir}/cssutils
137 %{py_sitescriptdir}/encutils
138 %{py_sitescriptdir}/cssutils-%{version}-py*.egg-info
139 %endif
140
141 %if %{with python3}
142 %files -n python3-%{module}
143 %defattr(644,root,root,755)
144 %attr(755,root,root) %{_bindir}/csscapture-3
145 %attr(755,root,root) %{_bindir}/csscombine-3
146 %attr(755,root,root) %{_bindir}/cssparse-3
147 %{py3_sitescriptdir}/cssutils
148 %{py3_sitescriptdir}/encutils
149 %{py3_sitescriptdir}/cssutils-%{version}-py*.egg-info
150 %endif
This page took 0.03027 seconds and 2 git commands to generate.