diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-dexml.spec | 177 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 179 insertions, 0 deletions
@@ -0,0 +1 @@ +/dexml-0.5.1.tar.gz diff --git a/python-dexml.spec b/python-dexml.spec new file mode 100644 index 0000000..66f93a2 --- /dev/null +++ b/python-dexml.spec @@ -0,0 +1,177 @@ +%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("<Person name='Foo McBar'><age>42</age></Person>") + >>> 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() + '<?xml version="1.0" ?><Person name="Handsome B. Wonderful"><age>36</age></Person>' +Malformed documents will raise a ParseError:: + >>> p = Person.parse("<Person><age>92</age></Person>") + 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) + '<Group name="Monty Python"><Person name="John Cleese"><age>69</age></Person><Person name="Terry Jones"><age>67</age></Person></Group>' +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("<Person name='Foo McBar'><age>42</age></Person>") + >>> 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() + '<?xml version="1.0" ?><Person name="Handsome B. Wonderful"><age>36</age></Person>' +Malformed documents will raise a ParseError:: + >>> p = Person.parse("<Person><age>92</age></Person>") + 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) + '<Group name="Monty Python"><Person name="John Cleese"><age>69</age></Person><Person name="Terry Jones"><age>67</age></Person></Group>' +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("<Person name='Foo McBar'><age>42</age></Person>") + >>> 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() + '<?xml version="1.0" ?><Person name="Handsome B. Wonderful"><age>36</age></Person>' +Malformed documents will raise a ParseError:: + >>> p = Person.parse("<Person><age>92</age></Person>") + 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) + '<Group name="Monty Python"><Person name="John Cleese"><age>69</age></Person><Person name="Terry Jones"><age>67</age></Person></Group>' +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 +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.1-1 +- Package Spec generated @@ -0,0 +1 @@ +7f7bbb66cdceb38adbc9092a9a159d87 dexml-0.5.1.tar.gz |
