summaryrefslogtreecommitdiff
path: root/python-warlock.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-03-09 18:01:50 +0000
committerCoprDistGit <infra@openeuler.org>2023-03-09 18:01:50 +0000
commit4c09517f02b12636f631ca7da9c8615a28f78ee1 (patch)
tree5238c9436724580c470cc3d1bb5374900c512f50 /python-warlock.spec
parent35cf09546acaa4e2af1829ab39863e02c6a50fd8 (diff)
automatic import of python-warlock
Diffstat (limited to 'python-warlock.spec')
-rw-r--r--python-warlock.spec329
1 files changed, 329 insertions, 0 deletions
diff --git a/python-warlock.spec b/python-warlock.spec
new file mode 100644
index 0000000..aeab943
--- /dev/null
+++ b/python-warlock.spec
@@ -0,0 +1,329 @@
+%global _empty_manifest_terminate_build 0
+Name: python-warlock
+Version: 2.0.1
+Release: 1
+Summary: Python object model built on JSON schema and JSON patch.
+License: Apache-2.0
+URL: http://github.com/bcwaldon/warlock
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/de/cf/ba9ac96d09b797c377e2c12c0eb6b19565f3b2a2efb55932d319e319b622/warlock-2.0.1.tar.gz
+BuildArch: noarch
+
+Requires: python3-jsonpatch
+Requires: python3-jsonschema
+
+%description
+# Warlock 🧙‍♀️
+
+**Create self-validating Python objects using JSON schema.**
+
+[![PyPI](https://img.shields.io/pypi/v/warlock.svg)][warlock]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/warlock.svg)][warlock]
+[![PyPI - Downloads](https://img.shields.io/pypi/dw/warlock.svg)][pypistats]
+
+[![Build Status](https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml/badge.svg)][ci-builds]
+[![Coverage Status](https://coveralls.io/repos/github/bcwaldon/warlock/badge.svg?branch=master)][coveralls]
+![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/bcwaldon/warlock/latest/master.svg)
+
+[![Package management: poetry](https://img.shields.io/badge/deps-poetry-blueviolet.svg)][poetry]
+[![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black/)
+
+## Installation
+
+Warlock is [available on PyPI][warlock]:
+
+```shell
+pip install warlock
+```
+
+## Usage
+
+1) Create your schema
+
+ ```python
+ >>> schema = {
+ 'name': 'Country',
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'abbreviation': {'type': 'string'},
+ 'population': {'type': 'integer'},
+ },
+ 'additionalProperties': False,
+ }
+ ```
+
+2) Create a model
+
+ ```python
+ >>> import warlock
+ >>> Country = warlock.model_factory(schema)
+ ```
+
+3) Create an object using your model
+
+ ```python
+ >>> sweden = Country(name='Sweden', abbreviation='SE')
+ ```
+
+4) Let the object validate itself
+
+ ```python
+ >>> sweden.name = 5
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'name' to '5'
+
+ >>> sweden.overlord = 'Bears'
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'overlord' to 'Bears'
+ ```
+
+5) Generate a [JSON Patch document](http://tools.ietf.org/html/draft-ietf-appsawg-json-patch) to track changes
+
+ ```python
+ >>> sweden.population=9453000
+ >>> sweden.patch
+ '[{"path": "/population", "value": 9453000, "op": "add"}]'
+ ```
+
+[warlock]: https://pypi.org/project/warlock/
+[pip]: https://pip.pypa.io/en/stable/
+[ci-builds]: https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml
+[coveralls]: https://coveralls.io/github/bcwaldon/warlock?branch=master
+[poetry]: https://poetry.eustace.io/docs/
+[pypistats]: https://pypistats.org/packages/warlock
+
+
+
+%package -n python3-warlock
+Summary: Python object model built on JSON schema and JSON patch.
+Provides: python-warlock
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-warlock
+# Warlock 🧙‍♀️
+
+**Create self-validating Python objects using JSON schema.**
+
+[![PyPI](https://img.shields.io/pypi/v/warlock.svg)][warlock]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/warlock.svg)][warlock]
+[![PyPI - Downloads](https://img.shields.io/pypi/dw/warlock.svg)][pypistats]
+
+[![Build Status](https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml/badge.svg)][ci-builds]
+[![Coverage Status](https://coveralls.io/repos/github/bcwaldon/warlock/badge.svg?branch=master)][coveralls]
+![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/bcwaldon/warlock/latest/master.svg)
+
+[![Package management: poetry](https://img.shields.io/badge/deps-poetry-blueviolet.svg)][poetry]
+[![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black/)
+
+## Installation
+
+Warlock is [available on PyPI][warlock]:
+
+```shell
+pip install warlock
+```
+
+## Usage
+
+1) Create your schema
+
+ ```python
+ >>> schema = {
+ 'name': 'Country',
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'abbreviation': {'type': 'string'},
+ 'population': {'type': 'integer'},
+ },
+ 'additionalProperties': False,
+ }
+ ```
+
+2) Create a model
+
+ ```python
+ >>> import warlock
+ >>> Country = warlock.model_factory(schema)
+ ```
+
+3) Create an object using your model
+
+ ```python
+ >>> sweden = Country(name='Sweden', abbreviation='SE')
+ ```
+
+4) Let the object validate itself
+
+ ```python
+ >>> sweden.name = 5
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'name' to '5'
+
+ >>> sweden.overlord = 'Bears'
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'overlord' to 'Bears'
+ ```
+
+5) Generate a [JSON Patch document](http://tools.ietf.org/html/draft-ietf-appsawg-json-patch) to track changes
+
+ ```python
+ >>> sweden.population=9453000
+ >>> sweden.patch
+ '[{"path": "/population", "value": 9453000, "op": "add"}]'
+ ```
+
+[warlock]: https://pypi.org/project/warlock/
+[pip]: https://pip.pypa.io/en/stable/
+[ci-builds]: https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml
+[coveralls]: https://coveralls.io/github/bcwaldon/warlock?branch=master
+[poetry]: https://poetry.eustace.io/docs/
+[pypistats]: https://pypistats.org/packages/warlock
+
+
+
+%package help
+Summary: Development documents and examples for warlock
+Provides: python3-warlock-doc
+%description help
+# Warlock 🧙‍♀️
+
+**Create self-validating Python objects using JSON schema.**
+
+[![PyPI](https://img.shields.io/pypi/v/warlock.svg)][warlock]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/warlock.svg)][warlock]
+[![PyPI - Downloads](https://img.shields.io/pypi/dw/warlock.svg)][pypistats]
+
+[![Build Status](https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml/badge.svg)][ci-builds]
+[![Coverage Status](https://coveralls.io/repos/github/bcwaldon/warlock/badge.svg?branch=master)][coveralls]
+![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/bcwaldon/warlock/latest/master.svg)
+
+[![Package management: poetry](https://img.shields.io/badge/deps-poetry-blueviolet.svg)][poetry]
+[![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black/)
+
+## Installation
+
+Warlock is [available on PyPI][warlock]:
+
+```shell
+pip install warlock
+```
+
+## Usage
+
+1) Create your schema
+
+ ```python
+ >>> schema = {
+ 'name': 'Country',
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'abbreviation': {'type': 'string'},
+ 'population': {'type': 'integer'},
+ },
+ 'additionalProperties': False,
+ }
+ ```
+
+2) Create a model
+
+ ```python
+ >>> import warlock
+ >>> Country = warlock.model_factory(schema)
+ ```
+
+3) Create an object using your model
+
+ ```python
+ >>> sweden = Country(name='Sweden', abbreviation='SE')
+ ```
+
+4) Let the object validate itself
+
+ ```python
+ >>> sweden.name = 5
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'name' to '5'
+
+ >>> sweden.overlord = 'Bears'
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ File "warlock/core.py", line 53, in __setattr__
+ raise InvalidOperation(msg)
+ warlock.core.InvalidOperation: Unable to set 'overlord' to 'Bears'
+ ```
+
+5) Generate a [JSON Patch document](http://tools.ietf.org/html/draft-ietf-appsawg-json-patch) to track changes
+
+ ```python
+ >>> sweden.population=9453000
+ >>> sweden.patch
+ '[{"path": "/population", "value": 9453000, "op": "add"}]'
+ ```
+
+[warlock]: https://pypi.org/project/warlock/
+[pip]: https://pip.pypa.io/en/stable/
+[ci-builds]: https://github.com/bcwaldon/warlock/actions/workflows/ci.yaml
+[coveralls]: https://coveralls.io/github/bcwaldon/warlock?branch=master
+[poetry]: https://poetry.eustace.io/docs/
+[pypistats]: https://pypistats.org/packages/warlock
+
+
+
+%prep
+%autosetup -n warlock-2.0.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-warlock -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.1-1
+- Package Spec generated