diff options
Diffstat (limited to 'python-zserio.spec')
-rw-r--r-- | python-zserio.spec | 318 |
1 files changed, 318 insertions, 0 deletions
diff --git a/python-zserio.spec b/python-zserio.spec new file mode 100644 index 0000000..a087d72 --- /dev/null +++ b/python-zserio.spec @@ -0,0 +1,318 @@ +%global _empty_manifest_terminate_build 0 +Name: python-zserio +Version: 2.11.0 +Release: 1 +Summary: Zserio runtime with compiler. +License: BSD-3 Clause +URL: https://github.com/ndsev/zserio-pypi +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/28/8d/4a0172ac76c3210b70f21cdd7d9df612d4d31e6acb485b0edc587924f34d/zserio-2.11.0.tar.gz +BuildArch: noarch + + +%description +Zserio PyPi package contains Zserio compiler and Zserio Python runtime. Zserio is serialization framework +available at [GitHub](http://zserio.org). + +## Installation + +To install Zserio compiler together with Zserio Python runtime, just run + +``` +pip install zserio +``` + +## Usage from command line + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run Zserio +compiler directly from command line by the following command: + +``` +zserio appl.zs -python gen +``` + +Then, if you run the python by the command + +``` +PYTHONPATH="gen" python +``` + +you will be able to use the generated Python sources by the following python commands + +```py +import appl.api as api +test_structure = api.TestStructure() +``` + +## Usage from Python + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run the +following python commands: + +```py +import zserio +api = zserio.generate("appl.zs", gen_dir = "gen") +test_structure = api.TestStructure() +``` + +For convenience, the method `generate` returns imported API for generated top level package. + +Alternatively, you can run zserio compiler directly by the following python commands: + +```py +import sys +import importlib +import zserio +completed_process = zserio.run_compiler(["appl.zs", "-python", "gen"]) +if completed_process.returncode == 0: + sys.path.append("gen") + api = importlib.import_module("appl.api") + test_structure = api.TestStructure() +``` + + + + +%package -n python3-zserio +Summary: Zserio runtime with compiler. +Provides: python-zserio +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-zserio +Zserio PyPi package contains Zserio compiler and Zserio Python runtime. Zserio is serialization framework +available at [GitHub](http://zserio.org). + +## Installation + +To install Zserio compiler together with Zserio Python runtime, just run + +``` +pip install zserio +``` + +## Usage from command line + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run Zserio +compiler directly from command line by the following command: + +``` +zserio appl.zs -python gen +``` + +Then, if you run the python by the command + +``` +PYTHONPATH="gen" python +``` + +you will be able to use the generated Python sources by the following python commands + +```py +import appl.api as api +test_structure = api.TestStructure() +``` + +## Usage from Python + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run the +following python commands: + +```py +import zserio +api = zserio.generate("appl.zs", gen_dir = "gen") +test_structure = api.TestStructure() +``` + +For convenience, the method `generate` returns imported API for generated top level package. + +Alternatively, you can run zserio compiler directly by the following python commands: + +```py +import sys +import importlib +import zserio +completed_process = zserio.run_compiler(["appl.zs", "-python", "gen"]) +if completed_process.returncode == 0: + sys.path.append("gen") + api = importlib.import_module("appl.api") + test_structure = api.TestStructure() +``` + + + + +%package help +Summary: Development documents and examples for zserio +Provides: python3-zserio-doc +%description help +Zserio PyPi package contains Zserio compiler and Zserio Python runtime. Zserio is serialization framework +available at [GitHub](http://zserio.org). + +## Installation + +To install Zserio compiler together with Zserio Python runtime, just run + +``` +pip install zserio +``` + +## Usage from command line + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run Zserio +compiler directly from command line by the following command: + +``` +zserio appl.zs -python gen +``` + +Then, if you run the python by the command + +``` +PYTHONPATH="gen" python +``` + +you will be able to use the generated Python sources by the following python commands + +```py +import appl.api as api +test_structure = api.TestStructure() +``` + +## Usage from Python + +Consider the following zserio schema which is stored to the source `appl.zs`: + +``` +package appl; + +struct TestStructure +{ + int32 value; +}; +``` + +To compile the schema by compiler and generate Python sources to the directory `gen`, you can run the +following python commands: + +```py +import zserio +api = zserio.generate("appl.zs", gen_dir = "gen") +test_structure = api.TestStructure() +``` + +For convenience, the method `generate` returns imported API for generated top level package. + +Alternatively, you can run zserio compiler directly by the following python commands: + +```py +import sys +import importlib +import zserio +completed_process = zserio.run_compiler(["appl.zs", "-python", "gen"]) +if completed_process.returncode == 0: + sys.path.append("gen") + api = importlib.import_module("appl.api") + test_structure = api.TestStructure() +``` + + + + +%prep +%autosetup -n zserio-2.11.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-zserio -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 2.11.0-1 +- Package Spec generated |