| 1 | # Note: this .spec is borrowed from python-lxml-3.4.4-2.fc24.src.rpm
|
|---|
| 2 |
|
|---|
| 3 | %if 0%{?fedora} > 12
|
|---|
| 4 | %global with_python3 1
|
|---|
| 5 | %endif
|
|---|
| 6 |
|
|---|
| 7 | %if 0%{?fedora} >= 20
|
|---|
| 8 | %global with_python3_cssselect 1
|
|---|
| 9 | %endif
|
|---|
| 10 |
|
|---|
| 11 | %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
|---|
| 12 |
|
|---|
| 13 | Name: python-lxml
|
|---|
| 14 | Version: 3.5.0
|
|---|
| 15 | Release: 1%{?dist}
|
|---|
| 16 | Summary: ElementTree-like Python bindings for libxml2 and libxslt
|
|---|
| 17 |
|
|---|
| 18 | Group: Development/Libraries
|
|---|
| 19 | License: BSD
|
|---|
| 20 | URL: http://lxml.de
|
|---|
| 21 | Source0: http://lxml.de/files/lxml-%{version}.tgz
|
|---|
| 22 | #Source1: http://lxml.de/files/lxml-%{version}.tgz.asc
|
|---|
| 23 |
|
|---|
| 24 | BuildRequires: libxslt-devel
|
|---|
| 25 |
|
|---|
| 26 | BuildRequires: python-devel
|
|---|
| 27 | #BuildRequires: python-setuptools
|
|---|
| 28 | #BuildRequires: python-cssselect
|
|---|
| 29 | #BuildRequires: Cython >= 0.20
|
|---|
| 30 |
|
|---|
| 31 | #Requires: python-cssselect
|
|---|
| 32 |
|
|---|
| 33 | %if 0%{?with_python3}
|
|---|
| 34 | BuildRequires: python3-devel
|
|---|
| 35 | BuildRequires: python3-setuptools
|
|---|
| 36 | %if 0%{?with_python3_cssselect}
|
|---|
| 37 | BuildRequires: python3-cssselect
|
|---|
| 38 | %endif
|
|---|
| 39 | %endif
|
|---|
| 40 |
|
|---|
| 41 | %description
|
|---|
| 42 | lxml provides a Python binding to the libxslt and libxml2 libraries.
|
|---|
| 43 | It follows the ElementTree API as much as possible in order to provide
|
|---|
| 44 | a more Pythonic interface to libxml2 and libxslt than the default
|
|---|
| 45 | bindings. In particular, lxml deals with Python Unicode strings
|
|---|
| 46 | rather than encoded UTF-8 and handles memory management automatically,
|
|---|
| 47 | unlike the default bindings.
|
|---|
| 48 |
|
|---|
| 49 | %package docs
|
|---|
| 50 | Summary: Documentation for %{name}
|
|---|
| 51 | Group: Documentation
|
|---|
| 52 | BuildArch: noarch
|
|---|
| 53 | %description docs
|
|---|
| 54 | This package provides the documentation for %{name}, e.g. the API as html.
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | %if 0%{?with_python3}
|
|---|
| 58 | %package -n python3-lxml
|
|---|
| 59 | Summary: ElementTree-like Python 3 bindings for libxml2 and libxslt
|
|---|
| 60 | Group: Development/Libraries
|
|---|
| 61 | %if 0%{?with_python3_cssselect}
|
|---|
| 62 | Requires: python3-cssselect
|
|---|
| 63 | %endif
|
|---|
| 64 |
|
|---|
| 65 | %description -n python3-lxml
|
|---|
| 66 | lxml provides a Python 3 binding to the libxslt and libxml2 libraries.
|
|---|
| 67 | It follows the ElementTree API as much as possible in order to provide
|
|---|
| 68 | a more Pythonic interface to libxml2 and libxslt than the default
|
|---|
| 69 | bindings. In particular, lxml deals with Python 3 Unicode strings
|
|---|
| 70 | rather than encoded UTF-8 and handles memory management automatically,
|
|---|
| 71 | unlike the default bindings.
|
|---|
| 72 | %endif
|
|---|
| 73 |
|
|---|
| 74 | %prep
|
|---|
| 75 | %setup -q -n lxml-%{version}
|
|---|
| 76 |
|
|---|
| 77 | ## remove the C extension so that it will be rebuilt using the latest Cython
|
|---|
| 78 | #rm -f src/lxml/lxml.etree.c
|
|---|
| 79 | #rm -f src/lxml/lxml.etree.h
|
|---|
| 80 | #rm -f src/lxml/lxml.etree_api.h
|
|---|
| 81 | #rm -f src/lxml/lxml.objectify.c
|
|---|
| 82 |
|
|---|
| 83 | chmod a-x doc/rest2html.py
|
|---|
| 84 | sed -i 's/\r//' doc/s5/ui/default/print.css \
|
|---|
| 85 | doc/s5/ep2008/atom.rng \
|
|---|
| 86 | doc/s5/ui/default/iepngfix.htc
|
|---|
| 87 |
|
|---|
| 88 | %if 0%{?with_python3}
|
|---|
| 89 | rm -rf %{py3dir}
|
|---|
| 90 | cp -r . %{py3dir}
|
|---|
| 91 | %endif
|
|---|
| 92 |
|
|---|
| 93 | %build
|
|---|
| 94 | CFLAGS="%{optflags}" %{__python} setup.py build
|
|---|
| 95 | #--with-cython
|
|---|
| 96 |
|
|---|
| 97 | %if 0%{?with_python3}
|
|---|
| 98 | cp src/lxml/lxml.etree.c %{py3dir}/src/lxml
|
|---|
| 99 | cp src/lxml/lxml.etree.h %{py3dir}/src/lxml
|
|---|
| 100 | cp src/lxml/lxml.etree_api.h %{py3dir}/src/lxml
|
|---|
| 101 | cp src/lxml/lxml.objectify.c %{py3dir}/src/lxml
|
|---|
| 102 |
|
|---|
| 103 | pushd %{py3dir}
|
|---|
| 104 | CFLAGS="%{optflags}" %{__python3} setup.py build --with-cython
|
|---|
| 105 | popd
|
|---|
| 106 | %endif
|
|---|
| 107 |
|
|---|
| 108 | %install
|
|---|
| 109 | %{__python} setup.py install --skip-build --no-compile --root %{buildroot}
|
|---|
| 110 | #--with-cython
|
|---|
| 111 |
|
|---|
| 112 | %if 0%{?with_python3}
|
|---|
| 113 | pushd %{py3dir}
|
|---|
| 114 | %{__python3} setup.py install --skip-build --no-compile --with-cython --root %{buildroot}
|
|---|
| 115 | popd
|
|---|
| 116 | %endif
|
|---|
| 117 |
|
|---|
| 118 | %check
|
|---|
| 119 | # @todo enable once we got python-unittest
|
|---|
| 120 | #BUILD_LIB_DIR=$(find $(pwd) -name "*.pyd" | head -n 1 | xargs dirname)
|
|---|
| 121 | #cp $BUILD_LIB_DIR/*.pyd src/lxml
|
|---|
| 122 | #export LANG=en_US.utf8
|
|---|
| 123 | #%{__python} test.py -p -v
|
|---|
| 124 | #export PYTHONPATH=src
|
|---|
| 125 | #%{__python} selftest.py
|
|---|
| 126 | #%{__python} selftest2.py
|
|---|
| 127 |
|
|---|
| 128 | %if 0%{?with_python3}
|
|---|
| 129 | pushd %{py3dir}
|
|---|
| 130 |
|
|---|
| 131 | BUILD_LIB_DIR=$(find $(pwd) -name "*.pyd" | head -n 1 | xargs dirname)
|
|---|
| 132 | cp $BUILD_LIB_DIR/*.pyd src/lxml
|
|---|
| 133 | export LANG=en_US.utf8
|
|---|
| 134 | %{__python3} test.py -p -v
|
|---|
| 135 | export PYTHONPATH=src
|
|---|
| 136 | %{__python3} selftest.py
|
|---|
| 137 | %{__python3} selftest2.py
|
|---|
| 138 |
|
|---|
| 139 | popd
|
|---|
| 140 | %endif
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 | %files
|
|---|
| 144 | %{!?_licensedir:%global license %%doc}
|
|---|
| 145 | %license LICENSES.txt
|
|---|
| 146 | %doc PKG-INFO CREDITS.txt CHANGES.txt
|
|---|
| 147 | %{python_sitearch}/lxml
|
|---|
| 148 | %{python_sitearch}/lxml-*.egg-info
|
|---|
| 149 |
|
|---|
| 150 | %files docs
|
|---|
| 151 | %doc doc/*
|
|---|
| 152 |
|
|---|
| 153 | %if 0%{?with_python3}
|
|---|
| 154 | %files -n python3-lxml
|
|---|
| 155 | %license LICENSES.txt
|
|---|
| 156 | %doc PKG-INFO CREDITS.txt CHANGES.txt
|
|---|
| 157 | %{python3_sitearch}/lxml-*.egg-info
|
|---|
| 158 | %{python3_sitearch}/lxml
|
|---|
| 159 | %endif
|
|---|
| 160 |
|
|---|
| 161 | %changelog
|
|---|
| 162 | * Thu Dec 12 2015 Dmitriy Kuminov <coding@dmik.org> 3.5.0-1
|
|---|
| 163 | - Initial package for version 3.5.0.
|
|---|