diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-10 18:13:53 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 18:13:53 +0000 |
commit | 0086e85a0e01aa59726ee5bd515162c55b5d17b1 (patch) | |
tree | abb7ec6914380559666e69b121a63d46ec207a4c | |
parent | b07085e87cd8b1b7594a2da34aa6df252f396cc8 (diff) |
automatic import of python-zenroom
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-zenroom.spec | 647 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 649 insertions, 0 deletions
@@ -0,0 +1 @@ +/zenroom-2.20.4.tar.gz diff --git a/python-zenroom.spec b/python-zenroom.spec new file mode 100644 index 0000000..4eebf48 --- /dev/null +++ b/python-zenroom.spec @@ -0,0 +1,647 @@ +%global _empty_manifest_terminate_build 0 +Name: python-zenroom +Version: 2.20.4 +Release: 1 +Summary: Zenroom for Python: Bindings of Zenroom library for Python. +License: AGPLv3 +URL: https://zenroom.org +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/45/80/3ee4890257be3fb043f491ae08a1a112f4a532f01925fa214fdf3653e43a/zenroom-2.20.4.tar.gz +BuildArch: noarch + +Requires: python3-pytest +Requires: python3-schema + +%description +# Use Zenroom in Python3 +<p align="center"> + <br/> + <a href="https://dev.zenroom.org/"> + <img src="https://dev.zenroom.org/_media/images/zenroom_logo.png" height="140" alt="Zenroom"> + </a> + <h2 align="center"> + zenroom.py ๐ + <br> + <sub>A Python3 wrapper of <a href="https://zenroom.org">Zenroom</a>, a secure and small virtual machine for crypto language processing</sub> </h2> + +<br><br> + + <a href="https://travis-ci.com/dyne/zenroom-py"> + <img src="https://travis-ci.com/dyne/zenroom-py.svg?branch=master" alt="Build status"/> + </a> + <a href="https://codecov.io/gh/dyne/zenroom-py"> + <img src="https://codecov.io/gh/dyne/zenroom-py/branch/master/graph/badge.svg" alt="Code coverage"/> + </a> + <a href="https://pypi.org/project/zenroom/"> + <img alt="PyPI" src="https://img.shields.io/pypi/v/zenroom.svg" alt="Latest release"> + </a> +</p> + +<hr/> + + +This library attempts to provide a very simple wrapper around the Zenroom +(https://zenroom.dyne.org/) crypto virtual machine developed as part of the +DECODE project (https://decodeproject.eu/), that aims to make the Zenroom +virtual machine easier to call from normal Python code. + +Zenroom itself does have good cross platform functionality, so if you are +interested in finding out more about the functionalities offered by Zenroom, +then please visit the website linked to above to find out more. + + +*** +## ๐พ Installation + +```bash +pip install zenroom +``` + +**NOTE** - the above command attempts to install the zenroom package, pulling in +the Zenroom VM as a precompiled binary, so will only work on Linux and macOS +machines. + +for the edge (syn to the latest commit on master) version please run: +```bash +pip install zenroom --pre +``` + + +*** +## ๐ฎ Usage + +Two main calls are exposed, one to run `zencode` and one for `zenroom scripts`. + +If you don't know what `zencode` is, you can start with this blogpost +https://decodeproject.eu/blog/smart-contracts-english-speaker +The official documentation is available on [https://dev.zenroom.org/zencode/](https://dev.zenroom.org/zencode/) + +A good set of examples of `zencode` contracts could be found on +* [zencode simple tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_simple) +* [zencode coconut tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_coconut) + + +### ๐ Python wrapper + +the wrapper exposes two simple calls: + +* `zenroom_exec` +* `zencode_exec` + +as the names suggest are the two methods to execute zenroom (lua scripts) and zencode. + +#### args +Both functions accept the same arguments: + +- `script` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the lua script or + the zencode script to be executed +- `keys` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional keys + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#keys-string) +- `data` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional data + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#data-string) +- `conf` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional conf + string to pass according to zen_config [here](https://github.com/dyne/Zenroom/blob/master/src/zen_config.c#L99-L104) + +#### return +Both functions return the same object result `ZenResult` that have two attributes: + +- `stdout` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stdout of the script execution +- `stderr` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stderr of the script execution + +##### Examples + +Example usage of `zencode_exec(script, keys=None, data=None, conf=None)` + + +```python +from zenroom import zenroom + +contract = """Scenario ecdh: Create a keypair" +Given that I am known as 'identifier' +When I create the keypair +Then print my data +""" + +result = zenroom.zencode_exec(contract) +print(result.output) +``` + + +Example usage of `zenroom_exec(script, keys=None, data=None, conf=None)` + +```python +from zenroom import zenroom + +script = "print('Hello world')" +result = zenroom.zenroom_exec(script) + +print(result.output) +``` + +The same arguments and the same result are applied as the `zencode_exec` call. + +*** +## ๐ Testing + +Tests are made with pytests, just run + +`python setup.py test` + +in [`zenroom_test.py`](https://github.com/dyne/Zenroom/blob/master/bindings/python3/tests/test_all.py) file you'll find more usage examples of the wrapper + +*** +## ๐ Links + +https://decodeproject.eu/ + +https://zenroom.org/ + +https://dev.zenroom.org/ + +## ๐ Acknowledgements + +Copyright (C) 2018-2022 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam + +Originally designed and written by Sam Mulube. + +Designed, written and maintained by Puria Nafisi Azizi + +Rewritten by Danilo Spinella and David Dashyan + +<img src="https://ec.europa.eu/cefdigital/wiki/download/attachments/289112547/logo-cef-digital-2021.png" width="310" alt="Project funded by the European Commission"> +This project is receiving funding from the European Unionโs Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE). + +*** + +## ๐ฅ Contributing +Please first take a look at the [Dyne.org - Contributor License Agreement](CONTRIBUTING.md) then + +1. ๐ [FORK IT](https://github.com/dyne/Zenroom//fork) +2. Create your feature branch `git checkout -b feature/branch` +3. Commit your changes `git commit -am 'Add some fooBar'` +4. Push to the branch `git push origin feature/branch` +5. Create a new Pull Request `gh pr create -f` +6. ๐ Thank you + +*** + +## ๐ผ License + + Zenroom.py - a python wrapper of zenroom + Copyright (c) 2018-2022 Dyne.org foundation, Amsterdam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + + + +%package -n python3-zenroom +Summary: Zenroom for Python: Bindings of Zenroom library for Python. +Provides: python-zenroom +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-zenroom +# Use Zenroom in Python3 +<p align="center"> + <br/> + <a href="https://dev.zenroom.org/"> + <img src="https://dev.zenroom.org/_media/images/zenroom_logo.png" height="140" alt="Zenroom"> + </a> + <h2 align="center"> + zenroom.py ๐ + <br> + <sub>A Python3 wrapper of <a href="https://zenroom.org">Zenroom</a>, a secure and small virtual machine for crypto language processing</sub> </h2> + +<br><br> + + <a href="https://travis-ci.com/dyne/zenroom-py"> + <img src="https://travis-ci.com/dyne/zenroom-py.svg?branch=master" alt="Build status"/> + </a> + <a href="https://codecov.io/gh/dyne/zenroom-py"> + <img src="https://codecov.io/gh/dyne/zenroom-py/branch/master/graph/badge.svg" alt="Code coverage"/> + </a> + <a href="https://pypi.org/project/zenroom/"> + <img alt="PyPI" src="https://img.shields.io/pypi/v/zenroom.svg" alt="Latest release"> + </a> +</p> + +<hr/> + + +This library attempts to provide a very simple wrapper around the Zenroom +(https://zenroom.dyne.org/) crypto virtual machine developed as part of the +DECODE project (https://decodeproject.eu/), that aims to make the Zenroom +virtual machine easier to call from normal Python code. + +Zenroom itself does have good cross platform functionality, so if you are +interested in finding out more about the functionalities offered by Zenroom, +then please visit the website linked to above to find out more. + + +*** +## ๐พ Installation + +```bash +pip install zenroom +``` + +**NOTE** - the above command attempts to install the zenroom package, pulling in +the Zenroom VM as a precompiled binary, so will only work on Linux and macOS +machines. + +for the edge (syn to the latest commit on master) version please run: +```bash +pip install zenroom --pre +``` + + +*** +## ๐ฎ Usage + +Two main calls are exposed, one to run `zencode` and one for `zenroom scripts`. + +If you don't know what `zencode` is, you can start with this blogpost +https://decodeproject.eu/blog/smart-contracts-english-speaker +The official documentation is available on [https://dev.zenroom.org/zencode/](https://dev.zenroom.org/zencode/) + +A good set of examples of `zencode` contracts could be found on +* [zencode simple tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_simple) +* [zencode coconut tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_coconut) + + +### ๐ Python wrapper + +the wrapper exposes two simple calls: + +* `zenroom_exec` +* `zencode_exec` + +as the names suggest are the two methods to execute zenroom (lua scripts) and zencode. + +#### args +Both functions accept the same arguments: + +- `script` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the lua script or + the zencode script to be executed +- `keys` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional keys + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#keys-string) +- `data` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional data + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#data-string) +- `conf` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional conf + string to pass according to zen_config [here](https://github.com/dyne/Zenroom/blob/master/src/zen_config.c#L99-L104) + +#### return +Both functions return the same object result `ZenResult` that have two attributes: + +- `stdout` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stdout of the script execution +- `stderr` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stderr of the script execution + +##### Examples + +Example usage of `zencode_exec(script, keys=None, data=None, conf=None)` + + +```python +from zenroom import zenroom + +contract = """Scenario ecdh: Create a keypair" +Given that I am known as 'identifier' +When I create the keypair +Then print my data +""" + +result = zenroom.zencode_exec(contract) +print(result.output) +``` + + +Example usage of `zenroom_exec(script, keys=None, data=None, conf=None)` + +```python +from zenroom import zenroom + +script = "print('Hello world')" +result = zenroom.zenroom_exec(script) + +print(result.output) +``` + +The same arguments and the same result are applied as the `zencode_exec` call. + +*** +## ๐ Testing + +Tests are made with pytests, just run + +`python setup.py test` + +in [`zenroom_test.py`](https://github.com/dyne/Zenroom/blob/master/bindings/python3/tests/test_all.py) file you'll find more usage examples of the wrapper + +*** +## ๐ Links + +https://decodeproject.eu/ + +https://zenroom.org/ + +https://dev.zenroom.org/ + +## ๐ Acknowledgements + +Copyright (C) 2018-2022 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam + +Originally designed and written by Sam Mulube. + +Designed, written and maintained by Puria Nafisi Azizi + +Rewritten by Danilo Spinella and David Dashyan + +<img src="https://ec.europa.eu/cefdigital/wiki/download/attachments/289112547/logo-cef-digital-2021.png" width="310" alt="Project funded by the European Commission"> +This project is receiving funding from the European Unionโs Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE). + +*** + +## ๐ฅ Contributing +Please first take a look at the [Dyne.org - Contributor License Agreement](CONTRIBUTING.md) then + +1. ๐ [FORK IT](https://github.com/dyne/Zenroom//fork) +2. Create your feature branch `git checkout -b feature/branch` +3. Commit your changes `git commit -am 'Add some fooBar'` +4. Push to the branch `git push origin feature/branch` +5. Create a new Pull Request `gh pr create -f` +6. ๐ Thank you + +*** + +## ๐ผ License + + Zenroom.py - a python wrapper of zenroom + Copyright (c) 2018-2022 Dyne.org foundation, Amsterdam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + + + +%package help +Summary: Development documents and examples for zenroom +Provides: python3-zenroom-doc +%description help +# Use Zenroom in Python3 +<p align="center"> + <br/> + <a href="https://dev.zenroom.org/"> + <img src="https://dev.zenroom.org/_media/images/zenroom_logo.png" height="140" alt="Zenroom"> + </a> + <h2 align="center"> + zenroom.py ๐ + <br> + <sub>A Python3 wrapper of <a href="https://zenroom.org">Zenroom</a>, a secure and small virtual machine for crypto language processing</sub> </h2> + +<br><br> + + <a href="https://travis-ci.com/dyne/zenroom-py"> + <img src="https://travis-ci.com/dyne/zenroom-py.svg?branch=master" alt="Build status"/> + </a> + <a href="https://codecov.io/gh/dyne/zenroom-py"> + <img src="https://codecov.io/gh/dyne/zenroom-py/branch/master/graph/badge.svg" alt="Code coverage"/> + </a> + <a href="https://pypi.org/project/zenroom/"> + <img alt="PyPI" src="https://img.shields.io/pypi/v/zenroom.svg" alt="Latest release"> + </a> +</p> + +<hr/> + + +This library attempts to provide a very simple wrapper around the Zenroom +(https://zenroom.dyne.org/) crypto virtual machine developed as part of the +DECODE project (https://decodeproject.eu/), that aims to make the Zenroom +virtual machine easier to call from normal Python code. + +Zenroom itself does have good cross platform functionality, so if you are +interested in finding out more about the functionalities offered by Zenroom, +then please visit the website linked to above to find out more. + + +*** +## ๐พ Installation + +```bash +pip install zenroom +``` + +**NOTE** - the above command attempts to install the zenroom package, pulling in +the Zenroom VM as a precompiled binary, so will only work on Linux and macOS +machines. + +for the edge (syn to the latest commit on master) version please run: +```bash +pip install zenroom --pre +``` + + +*** +## ๐ฎ Usage + +Two main calls are exposed, one to run `zencode` and one for `zenroom scripts`. + +If you don't know what `zencode` is, you can start with this blogpost +https://decodeproject.eu/blog/smart-contracts-english-speaker +The official documentation is available on [https://dev.zenroom.org/zencode/](https://dev.zenroom.org/zencode/) + +A good set of examples of `zencode` contracts could be found on +* [zencode simple tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_simple) +* [zencode coconut tests](https://github.com/dyne/Zenroom/tree/master/test/zencode_coconut) + + +### ๐ Python wrapper + +the wrapper exposes two simple calls: + +* `zenroom_exec` +* `zencode_exec` + +as the names suggest are the two methods to execute zenroom (lua scripts) and zencode. + +#### args +Both functions accept the same arguments: + +- `script` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the lua script or + the zencode script to be executed +- `keys` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional keys + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#keys-string) +- `data` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional data + string to pass in execution as documented in zenroom docs [here](https://dev.zenroom.org/wiki/how-to-exec/#data-string) +- `conf` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** the optional conf + string to pass according to zen_config [here](https://github.com/dyne/Zenroom/blob/master/src/zen_config.c#L99-L104) + +#### return +Both functions return the same object result `ZenResult` that have two attributes: + +- `stdout` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stdout of the script execution +- `stderr` **[string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)** holds the stderr of the script execution + +##### Examples + +Example usage of `zencode_exec(script, keys=None, data=None, conf=None)` + + +```python +from zenroom import zenroom + +contract = """Scenario ecdh: Create a keypair" +Given that I am known as 'identifier' +When I create the keypair +Then print my data +""" + +result = zenroom.zencode_exec(contract) +print(result.output) +``` + + +Example usage of `zenroom_exec(script, keys=None, data=None, conf=None)` + +```python +from zenroom import zenroom + +script = "print('Hello world')" +result = zenroom.zenroom_exec(script) + +print(result.output) +``` + +The same arguments and the same result are applied as the `zencode_exec` call. + +*** +## ๐ Testing + +Tests are made with pytests, just run + +`python setup.py test` + +in [`zenroom_test.py`](https://github.com/dyne/Zenroom/blob/master/bindings/python3/tests/test_all.py) file you'll find more usage examples of the wrapper + +*** +## ๐ Links + +https://decodeproject.eu/ + +https://zenroom.org/ + +https://dev.zenroom.org/ + +## ๐ Acknowledgements + +Copyright (C) 2018-2022 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam + +Originally designed and written by Sam Mulube. + +Designed, written and maintained by Puria Nafisi Azizi + +Rewritten by Danilo Spinella and David Dashyan + +<img src="https://ec.europa.eu/cefdigital/wiki/download/attachments/289112547/logo-cef-digital-2021.png" width="310" alt="Project funded by the European Commission"> +This project is receiving funding from the European Unionโs Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE). + +*** + +## ๐ฅ Contributing +Please first take a look at the [Dyne.org - Contributor License Agreement](CONTRIBUTING.md) then + +1. ๐ [FORK IT](https://github.com/dyne/Zenroom//fork) +2. Create your feature branch `git checkout -b feature/branch` +3. Commit your changes `git commit -am 'Add some fooBar'` +4. Push to the branch `git push origin feature/branch` +5. Create a new Pull Request `gh pr create -f` +6. ๐ Thank you + +*** + +## ๐ผ License + + Zenroom.py - a python wrapper of zenroom + Copyright (c) 2018-2022 Dyne.org foundation, Amsterdam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + + + +%prep +%autosetup -n zenroom-2.20.4 + +%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-zenroom -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 2.20.4-1 +- Package Spec generated @@ -0,0 +1 @@ +f06d813cec063c4bf18707d1c700f911 zenroom-2.20.4.tar.gz |