[packages/python3-FormEncode] up to 2.1.1
atler
atler at pld-linux.org
Sun Mar 16 23:18:35 CET 2025
commit baeb2c78f454ee424ab835289e3d9edb2446f1f5
Author: Jan Palus <atler at pld-linux.org>
Date: Sun Mar 16 23:17:37 2025 +0100
up to 2.1.1
no-egg-dep.patch | 35 ++++++++++
python-FormEncode.spec | 176 ------------------------------------------------
python3-FormEncode.spec | 106 +++++++++++++++++++++++++++++
3 files changed, 141 insertions(+), 176 deletions(-)
---
diff --git a/python-FormEncode.spec b/python-FormEncode.spec
deleted file mode 100644
index 59dc1b4..0000000
--- a/python-FormEncode.spec
+++ /dev/null
@@ -1,176 +0,0 @@
-#
-# Conditional build:
-%bcond_without doc # Sphinx documentation
-%bcond_without tests # unit tests
-%bcond_without python2 # CPython 2.x module
-%bcond_without python3 # CPython 3.x module
-
-%define module FormEncode
-Summary: HTML form validation, generation, and convertion package
-Summary(pl.UTF-8): Moduł do walidacji, tworzenia i konwersji formularzy HTML
-Name: python-%{module}
-# keep 2.0.x here for python2 support
-Version: 2.0.1
-Release: 4
-License: PSF
-Group: Development/Languages/Python
-#Source0Download: https://pypi.org/project/FormEncode/
-Source0: https://files.pythonhosted.org/packages/source/F/FormEncode/%{module}-%{version}.tar.gz
-# Source0-md5: 65a9ba7220890c3d26904bdafe3a5a35
-URL: http://formencode.org/
-%if %{with python2}
-BuildRequires: python-modules >= 1:2.7
-BuildRequires: python-setuptools
-BuildRequires: python-setuptools_scm < 6
-BuildRequires: python-setuptools_scm_git_archive
-%if %{with tests}
-BuildRequires: python-dns = 1.16.0
-BuildRequires: python-pycountry < 19
-BuildRequires: python-pytest < 4.7
-BuildRequires: python-six
-%endif
-%endif
-%if %{with python3}
-BuildRequires: python3-2to3 >= 1:3.6
-BuildRequires: python3-modules >= 1:3.6
-BuildRequires: python3-setuptools
-BuildRequires: python3-setuptools_scm
-BuildRequires: python3-setuptools_scm_git_archive
-%if %{with tests}
-BuildRequires: python3-dns >= 2.0.0
-BuildRequires: python3-pycountry >= 16.10.23
-BuildRequires: python3-pytest
-BuildRequires: python3-six
-%endif
-%endif
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.714
-BuildRequires: sed >= 4.0
-Requires: python-modules >= 1:2.7
-BuildArch: noarch
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-
-%description
-FormEncode validates and converts nested structures. It allows for a
-declarative form of defining the validation, and decoupled processes
-for filling and generating forms.
-
-%description -l pl.UTF-8
-FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych
-struktur. Pozwala na deklaratywny sposób definiowania reguł
-poprawności i niezależne od nich wypełnianie i generowanie formularzy.
-
-%package -n python3-%{module}
-Summary: HTML form validation, generation, and convertion package
-Summary(pl.UTF-8): Moduł do walidacji, tworzenia i konwersji formularzy HTML
-Group: Libraries/Python
-Requires: python3-modules >= 1:3.6
-
-%description -n python3-%{module}
-FormEncode validates and converts nested structures. It allows for a
-declarative form of defining the validation, and decoupled processes
-for filling and generating forms.
-
-%description -n python3-%{module} -l pl.UTF-8
-FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych
-struktur. Pozwala na deklaratywny sposób definiowania reguł
-poprawności i niezależne od nich wypełnianie i generowanie formularzy.
-
-%package apidocs
-Summary: API documentation for Python FormEncode module
-Summary(pl.UTF-8): Dokumentacja API modułu Pythona FormEncode
-Group: Documentation
-
-%description apidocs
-API documentation for Python FormEncode module.
-
-%description apidocs -l pl.UTF-8
-Dokumentacja API modułu Pythona FormEncode.
-
-%prep
-%setup -q -n %{module}-%{version}
-
-# uses network to validate domains (with one no longer valid anyway)
-%{__rm} formencode/tests/test_email.py
-# validator doctests cover Email and URL validators which include DNS lookups
-%{__sed} -i -e '/^modules / s/, validators//' formencode/tests/test_doctests.py
-
-%build
-%if %{with python2}
-%py_build
-
-%if %{with tests}
-PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
-%{__python} -m pytest build-2/lib/formencode/tests
-%endif
-%endif
-
-%if %{with python3}
-%py3_build
-
-%if %{with tests}
-PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
-%{__python3} -m pytest build-3/lib/formencode/tests
-%endif
-%endif
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-%if %{with python2}
-%py_install
-
-%{__mv} $RPM_BUILD_ROOT%{py_sitescriptdir}/docs built-docs
-
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/tests
-%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/FormEncode.pot
-%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po
-%py_postclean
-
-find $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \
- %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py2.lang
-%endif
-
-%if %{with python3}
-%py3_install
-
-%{__rm} -rf built-docs
-%{__mv} $RPM_BUILD_ROOT%{py3_sitescriptdir}/docs built-docs
-
-%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/tests
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/FormEncode.pot
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po
-
-find $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \
- %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%if %{with python2}
-%files -f py2.lang
-%defattr(644,root,root,755)
-%doc README.rst
-%dir %{py_sitescriptdir}/formencode
-%{py_sitescriptdir}/formencode/*.py[co]
-%dir %{py_sitescriptdir}/formencode/i18n
-%{py_sitescriptdir}/formencode/javascript
-%{py_sitescriptdir}/FormEncode-%{version}-py*.egg-info
-%endif
-
-%if %{with python3}
-%files -n python3-%{module} -f py3.lang
-%defattr(644,root,root,755)
-%doc README.rst
-%dir %{py3_sitescriptdir}/formencode
-%{py3_sitescriptdir}/formencode/*.py
-%{py3_sitescriptdir}/formencode/__pycache__
-%dir %{py3_sitescriptdir}/formencode/i18n
-%{py3_sitescriptdir}/formencode/javascript
-%{py3_sitescriptdir}/FormEncode-%{version}-py*.egg-info
-%endif
-
-%files apidocs
-%defattr(644,root,root,755)
-%doc built-docs/*
diff --git a/python3-FormEncode.spec b/python3-FormEncode.spec
new file mode 100644
index 0000000..9879a6c
--- /dev/null
+++ b/python3-FormEncode.spec
@@ -0,0 +1,106 @@
+#
+# Conditional build:
+%bcond_without doc # Sphinx documentation
+%bcond_without tests # unit tests
+
+%define module FormEncode
+Summary: HTML form validation, generation, and convertion package
+Summary(pl.UTF-8): Moduł do walidacji, tworzenia i konwersji formularzy HTML
+Name: python3-%{module}
+# keep 2.0.x here for python2 support
+Version: 2.1.1
+Release: 1
+License: PSF
+Group: Development/Languages/Python
+#Source0Download: https://pypi.org/project/FormEncode/
+Source0: https://files.pythonhosted.org/packages/source/f/formencode/formencode-%{version}.tar.gz
+# Source0-md5: d179386d31ae8c32e70d004dca19ac60
+Patch0: no-egg-dep.patch
+URL: http://formencode.org/
+BuildRequires: python3-modules >= 1:3.6
+BuildRequires: python3-setuptools
+BuildRequires: python3-setuptools_scm
+%if %{with tests}
+BuildRequires: pydoc3 >= 1:3.6
+BuildRequires: python3-dns >= 2.0.0
+BuildRequires: python3-pycountry >= 16.10.23
+BuildRequires: python3-pytest
+BuildRequires: python3-six
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: sed >= 4.0
+%{?with_doc:BuildRequires: sphinx-pdg}
+Requires: python3-modules >= 1:3.6
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+FormEncode validates and converts nested structures. It allows for a
+declarative form of defining the validation, and decoupled processes
+for filling and generating forms.
+
+%description -l pl.UTF-8
+FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych
+struktur. Pozwala na deklaratywny sposób definiowania reguł
+poprawności i niezależne od nich wypełnianie i generowanie formularzy.
+
+%package apidocs
+Summary: API documentation for Python FormEncode module
+Summary(pl.UTF-8): Dokumentacja API modułu Pythona FormEncode
+Group: Documentation
+
+%description apidocs
+API documentation for Python FormEncode module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona FormEncode.
+
+%prep
+%setup -q -n formencode-%{version}
+%patch -P0 -p1
+
+# uses network to validate domains (with one no longer valid anyway)
+%{__rm} tests/test_email.py
+# validator doctests cover Email and URL validators which include DNS lookups
+%{__sed} -i -e '/^modules / s/, validators//' tests/test_doctests.py
+
+%{__sed} -i -e 's/@VERSION@/%{version}/' docs/conf.py
+
+%build
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH="$(pwd)/build-3/lib" \
+%{__python3} -m pytest tests
+%endif
+
+%{?with_doc:PYTHONPATH="$(pwd)/build-3/lib" ./regen-docs}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+find $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \
+ %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -f py3.lang
+%defattr(644,root,root,755)
+%doc README.rst
+%dir %{py3_sitescriptdir}/formencode
+%{py3_sitescriptdir}/formencode/*.py
+%{py3_sitescriptdir}/formencode/__pycache__
+%dir %{py3_sitescriptdir}/formencode/i18n
+%{py3_sitescriptdir}/formencode/javascript
+%{py3_sitescriptdir}/FormEncode-%{version}-py*.egg-info
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/*
+%endif
diff --git a/no-egg-dep.patch b/no-egg-dep.patch
new file mode 100644
index 0000000..ba3ddef
--- /dev/null
+++ b/no-egg-dep.patch
@@ -0,0 +1,35 @@
+--- formencode-2.1.1/docs/conf.py.orig 2025-01-31 16:31:40.000000000 +0100
++++ formencode-2.1.1/docs/conf.py 2025-03-16 22:38:38.755210604 +0100
+@@ -39,9 +39,10 @@
+ # The version info for the project you're documenting, acts as replacement for
+ # |version| and |release|, also used in various other places throughout the
+ # built documents.
+-from pkg_resources import get_distribution
+-release = get_distribution('formencode').version
+-version = '.'.join(release.split('.')[:2])
++#from pkg_resources import get_distribution
++#release = get_distribution('formencode').version
++#version = '.'.join(release.split('.')[:2])
++version = '@VERSION@'
+
+ # The language for content autogenerated by Sphinx. Refer to documentation
+ # for a list of supported languages.
+--- formencode-2.1.1/tests/__init__.py.orig 2025-01-31 16:31:40.000000000 +0100
++++ formencode-2.1.1/tests/__init__.py 2025-03-16 23:14:50.717014211 +0100
+@@ -11,16 +11,3 @@
+
+ # Enable deprecation warnings (which are disabled by default)
+ warnings.simplefilter('default')
+-
+-try:
+- try:
+- import importlib.metadata as metadata
+- try:
+- metadata.distribution("FormEncode")
+- except metadata.PackageNotFoundError as error:
+- raise ImportError from error
+- except ImportError: # Python < 3.8
+- import pkg_resources
+- pkg_resources.require('FormEncode')
+-except ImportError as error:
+- raise ImportError("Install FormEncode before running the tests") from error
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python3-FormEncode.git/commitdiff/baeb2c78f454ee424ab835289e3d9edb2446f1f5
More information about the pld-cvs-commit
mailing list