summaryrefslogtreecommitdiff
path: root/python-elementpath.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-elementpath.spec')
-rw-r--r--python-elementpath.spec226
1 files changed, 226 insertions, 0 deletions
diff --git a/python-elementpath.spec b/python-elementpath.spec
new file mode 100644
index 0000000..03f0655
--- /dev/null
+++ b/python-elementpath.spec
@@ -0,0 +1,226 @@
+%global _empty_manifest_terminate_build 0
+Name: python-elementpath
+Version: 4.1.0
+Release: 1
+Summary: XPath 1.0/2.0/3.0/3.1 parsers and selectors for ElementTree and lxml
+License: MIT
+URL: https://github.com/sissaschool/elementpath
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ff/cf/0d6f2c642d156b884b8e626332ece1f5c7243376fd207ec4e7bca89ab978/elementpath-4.1.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-tox
+Requires: python3-coverage
+Requires: python3-lxml
+Requires: python3-xmlschema
+Requires: python3-Sphinx
+Requires: python3-memory-profiler
+Requires: python3-memray
+Requires: python3-flake8
+Requires: python3-mypy
+Requires: python3-lxml-stubs
+
+%description
+You can install the package with *pip* in a Python 3.7+ environment::
+ pip install elementpath
+For using it import the package and apply the selectors on ElementTree nodes:
+>>> import elementpath
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+The *select* API provides the standard XPath result format that is a list or an elementary
+datatype's value. If you want only to iterate over results you can use the generator function
+*iter_select* that accepts the same arguments of *select*.
+The selectors API works also using XML data trees based on the `lxml.etree <http://lxml.de>`_
+library:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+When you need to apply the same XPath expression to several XML data you can also use the
+*Selector* class, creating an instance and then using it to apply the path on distinct XML
+data:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> selector = elementpath.Selector('/A/*/*')
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+>>> root = etree.XML('<A><B1><C0/></B1><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C0 at ...>, <Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+Public API classes and functions are described into the
+`elementpath manual on the "Read the Docs" site <http://elementpath.readthedocs.io/en/latest/>`_.
+For default the XPath 2.0 is used. If you need XPath 1.0 parser provide the *parser* argument:
+>>> from elementpath import select, XPath1Parser
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> select(root, '/A/B2/*', parser=XPath1Parser)
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+For XPath 3.0/3.1 import the parser from *elementpath.xpath3* subpackage, that is not loaded
+for default:
+>>> from elementpath.xpath3 import XPath3Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath3Parser)
+0.7853981633974483
+Note: *XPath3Parser* is an alias of *XPath31Parser*.
+If you need only XPath 3.0 you can also use a more specific subpackage,
+avoiding the loading of XPath 3.1 implementation:
+>>> from elementpath.xpath30 import XPath30Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath30Parser)
+0.7853981633974483
+
+%package -n python3-elementpath
+Summary: XPath 1.0/2.0/3.0/3.1 parsers and selectors for ElementTree and lxml
+Provides: python-elementpath
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-elementpath
+You can install the package with *pip* in a Python 3.7+ environment::
+ pip install elementpath
+For using it import the package and apply the selectors on ElementTree nodes:
+>>> import elementpath
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+The *select* API provides the standard XPath result format that is a list or an elementary
+datatype's value. If you want only to iterate over results you can use the generator function
+*iter_select* that accepts the same arguments of *select*.
+The selectors API works also using XML data trees based on the `lxml.etree <http://lxml.de>`_
+library:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+When you need to apply the same XPath expression to several XML data you can also use the
+*Selector* class, creating an instance and then using it to apply the path on distinct XML
+data:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> selector = elementpath.Selector('/A/*/*')
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+>>> root = etree.XML('<A><B1><C0/></B1><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C0 at ...>, <Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+Public API classes and functions are described into the
+`elementpath manual on the "Read the Docs" site <http://elementpath.readthedocs.io/en/latest/>`_.
+For default the XPath 2.0 is used. If you need XPath 1.0 parser provide the *parser* argument:
+>>> from elementpath import select, XPath1Parser
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> select(root, '/A/B2/*', parser=XPath1Parser)
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+For XPath 3.0/3.1 import the parser from *elementpath.xpath3* subpackage, that is not loaded
+for default:
+>>> from elementpath.xpath3 import XPath3Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath3Parser)
+0.7853981633974483
+Note: *XPath3Parser* is an alias of *XPath31Parser*.
+If you need only XPath 3.0 you can also use a more specific subpackage,
+avoiding the loading of XPath 3.1 implementation:
+>>> from elementpath.xpath30 import XPath30Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath30Parser)
+0.7853981633974483
+
+%package help
+Summary: Development documents and examples for elementpath
+Provides: python3-elementpath-doc
+%description help
+You can install the package with *pip* in a Python 3.7+ environment::
+ pip install elementpath
+For using it import the package and apply the selectors on ElementTree nodes:
+>>> import elementpath
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+The *select* API provides the standard XPath result format that is a list or an elementary
+datatype's value. If you want only to iterate over results you can use the generator function
+*iter_select* that accepts the same arguments of *select*.
+The selectors API works also using XML data trees based on the `lxml.etree <http://lxml.de>`_
+library:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> elementpath.select(root, '/A/B2/*')
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+When you need to apply the same XPath expression to several XML data you can also use the
+*Selector* class, creating an instance and then using it to apply the path on distinct XML
+data:
+>>> import elementpath
+>>> import lxml.etree as etree
+>>> selector = elementpath.Selector('/A/*/*')
+>>> root = etree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+>>> root = etree.XML('<A><B1><C0/></B1><B2><C1/><C2/><C3/></B2></A>')
+>>> selector.select(root)
+[<Element C0 at ...>, <Element C1 at ...>, <Element C2 at ...>, <Element C3 at ...>]
+Public API classes and functions are described into the
+`elementpath manual on the "Read the Docs" site <http://elementpath.readthedocs.io/en/latest/>`_.
+For default the XPath 2.0 is used. If you need XPath 1.0 parser provide the *parser* argument:
+>>> from elementpath import select, XPath1Parser
+>>> from xml.etree import ElementTree
+>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
+>>> select(root, '/A/B2/*', parser=XPath1Parser)
+[<Element 'C1' at ...>, <Element 'C2' at ...>, <Element 'C3' at ...>]
+For XPath 3.0/3.1 import the parser from *elementpath.xpath3* subpackage, that is not loaded
+for default:
+>>> from elementpath.xpath3 import XPath3Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath3Parser)
+0.7853981633974483
+Note: *XPath3Parser* is an alias of *XPath31Parser*.
+If you need only XPath 3.0 you can also use a more specific subpackage,
+avoiding the loading of XPath 3.1 implementation:
+>>> from elementpath.xpath30 import XPath30Parser
+>>> select(root, 'math:atan(1.0e0)', parser=XPath30Parser)
+0.7853981633974483
+
+%prep
+%autosetup -n elementpath-4.1.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-elementpath -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 4.1.0-1
+- Package Spec generated