%global _empty_manifest_terminate_build 0 Name: python-dexml Version: 0.5.1 Release: 1 Summary: a dead-simple Object-XML mapper for Python License: MIT URL: http://packages.python.org/dexml Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f1/9d/47531577926234bdea59345e6acc326cc008730cbf0c6a4b5703bbee4ca1/dexml-0.5.1.tar.gz BuildArch: noarch %description Let's face it: xml is a fact of modern life. I'd even go so far as to say that it's *good* at what is does. But that doesn't mean it's easy to work with and it doesn't mean that we have to like it. Most of the time, XML just needs to get out of the way and let you do some actual work instead of writing code to traverse and manipulate yet another DOM. The dexml module takes the obvious mapping between XML tags and Python objects and lets you capture that as cleanly as possible. Loosely inspired by Django's ORM, you write simple class definitions to define the expected structure of your XML document. Like so:: >>> import dexml >>> from dexml import fields >>> class Person(dexml.Model): Then you can parse an XML document into an object like this:: >>> p = Person.parse("42") >>> p.name u'Foo McBar' >>> p.age 42 And you can render an object into an XML document like this:: >>> p = Person(name="Handsome B. Wonderful",age=36) >>> p.render() '36' Malformed documents will raise a ParseError:: >>> p = Person.parse("92") Traceback (most recent call last): ParseError: required field not found: 'name' Of course, it gets more interesting when you nest Model definitions, like this:: >>> class Group(dexml.Model): >>> g = Group(name="Monty Python") >>> g.members.append(Person(name="John Cleese",age=69)) >>> g.members.append(Person(name="Terry Jones",age=67)) >>> g.render(fragment=True) '6967' There's support for XML namespaces, default field values, case-insensitive parsing, and more fun stuff. Check out the documentation on the following classes for more details: %package -n python3-dexml Summary: a dead-simple Object-XML mapper for Python Provides: python-dexml BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-dexml Let's face it: xml is a fact of modern life. I'd even go so far as to say that it's *good* at what is does. But that doesn't mean it's easy to work with and it doesn't mean that we have to like it. Most of the time, XML just needs to get out of the way and let you do some actual work instead of writing code to traverse and manipulate yet another DOM. The dexml module takes the obvious mapping between XML tags and Python objects and lets you capture that as cleanly as possible. Loosely inspired by Django's ORM, you write simple class definitions to define the expected structure of your XML document. Like so:: >>> import dexml >>> from dexml import fields >>> class Person(dexml.Model): Then you can parse an XML document into an object like this:: >>> p = Person.parse("42") >>> p.name u'Foo McBar' >>> p.age 42 And you can render an object into an XML document like this:: >>> p = Person(name="Handsome B. Wonderful",age=36) >>> p.render() '36' Malformed documents will raise a ParseError:: >>> p = Person.parse("92") Traceback (most recent call last): ParseError: required field not found: 'name' Of course, it gets more interesting when you nest Model definitions, like this:: >>> class Group(dexml.Model): >>> g = Group(name="Monty Python") >>> g.members.append(Person(name="John Cleese",age=69)) >>> g.members.append(Person(name="Terry Jones",age=67)) >>> g.render(fragment=True) '6967' There's support for XML namespaces, default field values, case-insensitive parsing, and more fun stuff. Check out the documentation on the following classes for more details: %package help Summary: Development documents and examples for dexml Provides: python3-dexml-doc %description help Let's face it: xml is a fact of modern life. I'd even go so far as to say that it's *good* at what is does. But that doesn't mean it's easy to work with and it doesn't mean that we have to like it. Most of the time, XML just needs to get out of the way and let you do some actual work instead of writing code to traverse and manipulate yet another DOM. The dexml module takes the obvious mapping between XML tags and Python objects and lets you capture that as cleanly as possible. Loosely inspired by Django's ORM, you write simple class definitions to define the expected structure of your XML document. Like so:: >>> import dexml >>> from dexml import fields >>> class Person(dexml.Model): Then you can parse an XML document into an object like this:: >>> p = Person.parse("42") >>> p.name u'Foo McBar' >>> p.age 42 And you can render an object into an XML document like this:: >>> p = Person(name="Handsome B. Wonderful",age=36) >>> p.render() '36' Malformed documents will raise a ParseError:: >>> p = Person.parse("92") Traceback (most recent call last): ParseError: required field not found: 'name' Of course, it gets more interesting when you nest Model definitions, like this:: >>> class Group(dexml.Model): >>> g = Group(name="Monty Python") >>> g.members.append(Person(name="John Cleese",age=69)) >>> g.members.append(Person(name="Terry Jones",age=67)) >>> g.render(fragment=True) '6967' There's support for XML namespaces, default field values, case-insensitive parsing, and more fun stuff. Check out the documentation on the following classes for more details: %prep %autosetup -n dexml-0.5.1 %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-dexml -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Sun Apr 23 2023 Python_Bot - 0.5.1-1 - Package Spec generated