From: Jakub Bogusz Date: Fri, 11 Sep 2020 19:49:33 +0000 (+0200) Subject: - new X-Git-Tag: auto/th/python-schema-0.7.2-1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=86e722cc9c27a11fabbc3375fb070f5a0f18fbd0;p=packages%2Fpython-schema.git - new --- 86e722cc9c27a11fabbc3375fb070f5a0f18fbd0 diff --git a/python-schema-requirements.patch b/python-schema-requirements.patch new file mode 100644 index 0000000..e41cf79 --- /dev/null +++ b/python-schema-requirements.patch @@ -0,0 +1,19 @@ +--- schema-0.7.2/requirements.txt.orig 2020-04-15 01:51:34.000000000 +0200 ++++ schema-0.7.2/requirements.txt 2020-09-11 20:55:32.136670218 +0200 +@@ -1 +1 @@ +-contextlib2>=0.5.5 ++contextlib2>=0.5.5;python_version<"2.7" +--- schema-0.7.2/test_schema.py.orig 2020-04-15 01:51:34.000000000 +0200 ++++ schema-0.7.2/test_schema.py 2020-09-11 21:06:30.749768871 +0200 +@@ -10,7 +10,10 @@ + from functools import partial + from operator import methodcaller + +-from mock import Mock ++try: ++ from unittest.mock import Mock ++except: ++ from mock import Mock + from pytest import mark, raises + from schema import ( + And, diff --git a/python-schema.spec b/python-schema.spec new file mode 100644 index 0000000..7f29fab --- /dev/null +++ b/python-schema.spec @@ -0,0 +1,125 @@ +# +# Conditional build: +%bcond_without tests # unit tests +%bcond_without python2 # CPython 2.x module +%bcond_without python3 # CPython 3.x module + +Summary: Schema validation just got Pythonic +Summary(pl.UTF-8): Pythonowe sprawdzanie zgodności ze schematem +Name: python-schema +Version: 0.7.2 +Release: 1 +License: MIT +Group: Libraries/Python +#Source0Download: https://pypi.org/simple/schema/ +Source0: https://files.pythonhosted.org/packages/source/s/schema/schema-%{version}.tar.gz +# Source0-md5: e9b98f979dbda29c3f7bc63e09b20878 +Patch0: %{name}-requirements.patch +URL: https://pypi.org/project/schema/ +%if %{with python2} +BuildRequires: python-modules >= 1:2.6 +BuildRequires: python-setuptools +%if "%{py_ver}" < "2.7" +BuildRequires: python-contextlib2 >= 0.5.5 +%endif +%if %{with tests} +BuildRequires: python-mock +BuildRequires: python-pytest +%endif +%endif +%if %{with python3} +BuildRequires: python3-modules >= 1:3.2 +BuildRequires: python3-setuptools +%if %{with tests} +BuildRequires: python3-pytest +%endif +%endif +BuildRequires: rpm-pythonprov +BuildRequires: rpmbuild(macros) >= 1.714 +Requires: python-modules >= 1:2.6 +BuildArch: noarch +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +schema is a library for validating Python data structures, such as +those obtained from config-files, forms, external services or +command-line parsing, converted from JSON/YAML (or something else) to +Python data-types. + +%description -l pl.UTF-8 +schema to biblioteka do sprawdzania poprawności pythonowych struktur +danych, takich jak pochodzące z plików konfiguracyjnych, formularzy, +usług zewnętrznych czy analizy wiersza poleceń, przekształcone z +JSON-a/YAML-a (lub czegoś innego) do typów pythonowych. + +%package -n python3-schema +Summary: Schema validation just got Pythonic +Summary(pl.UTF-8): Pythonowe sprawdzanie zgodności ze schematem +Group: Libraries/Python +Requires: python3-modules >= 1:3.2 + +%description -n python3-schema +schema is a library for validating Python data structures, such as +those obtained from config-files, forms, external services or +command-line parsing, converted from JSON/YAML (or something else) to +Python data-types. + +%description -n python3-schema -l pl.UTF-8 +schema to biblioteka do sprawdzania poprawności pythonowych struktur +danych, takich jak pochodzące z plików konfiguracyjnych, formularzy, +usług zewnętrznych czy analizy wiersza poleceń, przekształcone z +JSON-a/YAML-a (lub czegoś innego) do typów pythonowych. + +%prep +%setup -q -n schema-%{version} +%patch0 -p1 + +%build +%if %{with python2} +%py_build + +%if %{with tests} +%{__python} -m pytest test_schema.py +%endif +%endif + +%if %{with python3} +%py3_build + +%if %{with tests} +%{__python3} -m pytest test_schema.py +%endif +%endif + +%install +rm -rf $RPM_BUILD_ROOT + +%if %{with python2} +%py_install + +%py_postclean +%endif + +%if %{with python3} +%py3_install +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%if %{with python2} +%files +%defattr(644,root,root,755) +%doc LICENSE-MIT README.rst +%{py_sitescriptdir}/schema.py[co] +%{py_sitescriptdir}/schema-%{version}-py*.egg-info +%endif + +%if %{with python3} +%files -n python3-schema +%defattr(644,root,root,755) +%doc LICENSE-MIT README.rst +%{py3_sitescriptdir}/schema.py +%{py3_sitescriptdir}/__pycache__/schema.cpython-*.py[co] +%{py3_sitescriptdir}/schema-%{version}-py*.egg-info +%endif