commit 221a035004da1f3cd7adbe5e630ecabfa9c650528c0f7bd8513fa245136b9d57 Author: Steve Kowalik Date: Tue Sep 10 04:13:08 2024 +0000 - Add patch do-not-always-use-cgi-module.patch: * Support Python 3.13 by making use of cgi optional. - Switch to autosetup macro. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-FormEncode?expand=0&rev=35 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/FormEncode-2.1.0.tar.gz b/FormEncode-2.1.0.tar.gz new file mode 100644 index 0000000..407f2d4 --- /dev/null +++ b/FormEncode-2.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb74d223078a28cf015fa88966c6e34f2d18d75127318d65c144bed9afc4263f +size 277757 diff --git a/do-not-always-use-cgi-module.patch b/do-not-always-use-cgi-module.patch new file mode 100644 index 0000000..8da80e4 --- /dev/null +++ b/do-not-always-use-cgi-module.patch @@ -0,0 +1,56 @@ +From 77053ce944c11b1bae67cee387275e9f36d8d049 Mon Sep 17 00:00:00 2001 +From: Oleg Broytman +Date: Fri, 10 Nov 2023 18:17:15 +0300 +Subject: [PATCH] Protect `import cgi` + +Module `cgi` was declared obsolete in Python 3.11 +and will be removed in 3.13. + +Fixes: #175. +--- + src/formencode/validators.py | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/formencode/validators.py b/src/formencode/validators.py +index f2011b4..6f272b7 100644 +--- a/src/formencode/validators.py ++++ b/src/formencode/validators.py +@@ -5,7 +5,10 @@ + Validator/Converters for use with FormEncode. + """ + +-import cgi ++try: ++ import cgi ++except ImportError: # Python >= 3.13 ++ cgi = None + import re + import warnings + from encodings import idna +@@ -1772,7 +1775,7 @@ class FieldStorageUploadConverter(FancyValidator): + no upload was given). + """ + def _convert_to_python(self, value, state=None): +- if isinstance(value, cgi.FieldStorage): ++ if cgi and isinstance(value, cgi.FieldStorage): + if getattr(value, 'filename', None): + return value + raise Invalid('invalid', value, state) +@@ -1780,7 +1783,7 @@ def _convert_to_python(self, value, state=None): + return value + + def is_empty(self, value): +- if isinstance(value, cgi.FieldStorage): ++ if cgi and isinstance(value, cgi.FieldStorage): + return not bool(getattr(value, 'filename', None)) + return FancyValidator.is_empty(self, value) + +@@ -1825,7 +1828,7 @@ def _convert_to_python(self, value, state): + upload = value.get(self.upload_key) + static = value.get(self.static_key, '').strip() + filename = content = None +- if isinstance(upload, cgi.FieldStorage): ++ if cgi and isinstance(upload, cgi.FieldStorage): + filename = upload.filename + content = upload.value + elif isinstance(upload, str) and upload: diff --git a/python-FormEncode.changes b/python-FormEncode.changes new file mode 100644 index 0000000..00c0006 --- /dev/null +++ b/python-FormEncode.changes @@ -0,0 +1,381 @@ +------------------------------------------------------------------- +Tue Sep 10 04:11:22 UTC 2024 - Steve Kowalik + +- Add patch do-not-always-use-cgi-module.patch: + * Support Python 3.13 by making use of cgi optional. +- Switch to autosetup macro. + +------------------------------------------------------------------- +Tue Apr 16 13:25:39 UTC 2024 - Markéta Machová + +- Remove unneeded dependency on six + * https://github.com/formencode/formencode/commit/98e9e97e + +------------------------------------------------------------------- +Sat Dec 16 21:00:19 UTC 2023 - Dirk Müller + +- update to 2.1.0: + * Add support for Python 3.7 to 3.12, end support for older Python + versions + * Context.set() now works as a context manager + * Fix binary of swedish translation + * Some internal code cleanup and modernization + +------------------------------------------------------------------- +Tue Jul 18 02:48:07 UTC 2023 - Steve Kowalik + +- Clean up Python 2 leftovers. +- Switch to pyproject macros. +- Drop BuildRequires on setuptools_scm_git_archive + +------------------------------------------------------------------- +Fri Apr 21 12:20:37 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:41:25 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Thu Dec 23 14:17:15 UTC 2021 - Ben Greiner + +- Update to 2.0.1 + * Add support for 3.10 + * use Pytest instead of Nose and Github Actions instead of Travis + for tests + * Documentation updates + * Note this will be the last version to support Python 2.7. The + next version will be 2.1 to signal this change. If you want to + keep support for Python 2.7 update your dependencies spec to be + below 2.1 +- Release 2.0.0 + * FormEncode can now run on Python 3.6 and higher without needing + to run 2to3 first. + * FormEncode 2.0 is no longer compatible with Python 2.6 and 3.2 + to 3.5. If you need Python 2.6 or 3.2 to 3.5 compatibility + please use FormEncode 1.3. You might also try FormEncode + 2.0.0a1 which supports Python 2.6 and Python 3.3-3.5. + * This will be the last major version to support Python 2.7 + * Add strict flag to USPostalCode to raise error on postal codes + that has too many digits instead of just truncating + * Various Python 3 fixes + * Serbian latin translation + * Changed License to MIT + * Dutch, UK, Greek and South Korean postal code format fixes + * Add postal code formats for Switzerland, Cyprus, Faroe Islands, + San Marino, Ukraine and Vatican City. + * Add ISODateTimeConverter validator + * Add ability to target htmlfill to particular form or ignore a + form + * Fix format errors in some translations + * The version of the library can be checked using + formencode.__version__ +- Drop patches + * new-pycountry.patch + * python-FormEncode-remove-nose.patch + * remove-online-tests.patch + * six.patch +- Find lang files + +------------------------------------------------------------------- +Fri Jul 10 12:51:17 UTC 2020 - pgajdos@suse.com + +- switch from nose to pytest +- added patches + fix https://github.com/formencode/formencode/pull/154 + + python-FormEncode-remove-nose.patch + +------------------------------------------------------------------- +Thu Mar 7 11:09:21 UTC 2019 - Tomáš Chvátal + +- Really run tests under python3 +- Add patch to work with python3: + * six.patch + +------------------------------------------------------------------- +Mon Mar 4 16:23:43 UTC 2019 - Tomáš Chvátal + +- Remove online tests: + * remove-online-tests.patch +- Work with new pycountry: + * new-pycountry.patch +- Run tests + +------------------------------------------------------------------- +Mon Dec 10 14:55:26 UTC 2018 - Tomáš Chvátal + +- Fix fdupes call +- Update to 1.3.1: + * no obvious changelog + +------------------------------------------------------------------- +Tue Dec 4 12:48:11 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Thu Aug 24 13:38:57 UTC 2017 - jmatejek@suse.com + +- singlespec auto-conversion +- common -doc subpackage +- improve packaging of docs + +------------------------------------------------------------------- +Wed Mar 9 10:07:35 UTC 2016 - bwiedemann@suse.com + +- Drop build date from doc to fix build-compare + +------------------------------------------------------------------- +Tue May 5 14:33:11 UTC 2015 - benoit.monin@gmx.fr + +- update to version 1.3.0: + * Support validation of email addresses with unicode domain names + * FormEncode 1.3 is no longer compatible with Python 2.3, 2.4, or + 2.5 + * FormEncode now also runs under Python 3.2 and 3.3 + * Validation of email addresses using resolve_domain option now + requires the dnspython third party library instead of pyDNS + * The FancyValidator methods _to_python, _from_python, + validate_python and validate_other have been renamed to + _convert_to_python, _convert_from_python, _validate_python and + _validate_other, respectively +- add fdupes as BuildRequires and call it after install +- fix end of line of README.rst +- remove chmod of msgfmt.py: file deleted upstream +- install html documentation in the docdir of the main package +- do not install PKG-INFO in the documentation: already provided + by the egg-info + +------------------------------------------------------------------- +Thu Oct 24 11:05:56 UTC 2013 - speilicke@suse.com + +- Require python-setuptools instead of distribute (upstreams merged) + +------------------------------------------------------------------- +Mon Aug 5 13:25:42 UTC 2013 - hpj@urpla.net + +- somebody updated this package to 1.2.6 (not me) +- added missing pieces in order to generate sphinx documentation +- create documentation in separate -doc package +- fix various wrong line endings + +------------------------------------------------------------------- +Mon Jun 10 12:28:02 UTC 2013 - dmueller@suse.com + +- update to 1.2.5: + * The method field_is_empty was added to + formencode.validators.FormValidator + * Fix packaging issue with i18n files (from Juliusz Gonera) + +------------------------------------------------------------------- +Wed Mar 14 13:44:30 UTC 2012 - saschpe@suse.de + +- Set license to SDPX style (Python-2.0) +- Removed outdated %clean section +- Simplified macro usage +- Only package HTML documentation (not the doc sources) + +------------------------------------------------------------------- +Thu Sep 1 08:46:05 UTC 2011 - saschpe@suse.de + +- Add provides/obsoletes for python-formencode + +------------------------------------------------------------------- +Thu Sep 1 08:38:45 UTC 2011 - saschpe@suse.de + +- Renamed to python-FormEncode to match upstream name +- Properly package documentation + +------------------------------------------------------------------- +Sun Jun 7 00:01:01 CEST 2009 - lars@linux-schulserver.de + +- disable runtime dependency to python-setuptools + +------------------------------------------------------------------- +Mon Apr 27 17:51:38 CEST 2009 - lars@linux-schulserver.de + +- update to 1.2.2 +- remove FormEncode-1.2-svn-fixes.patch +- added rpmlintrc + +------------------------------------------------------------------- +Sun Dec 14 00:00:00 CET 2008 - jfunk@funktronics.ca + +- Apply some fixes from SVN + +------------------------------------------------------------------- +Wed Dec 03 00:00:00 CET 2008 - jfunk@funktronics.ca + +- Update to 1.2 + * Added :class:`formencode.validators.IPAddress`, validating IP + addresses, from Leandro Lucarella. + * Added :meth:`formencode.api.Invalid.__unicode__` + * In :mod:`formencode.htmlfill` use a default encoding of utf8 when + handling mixed ``str``/``unicode`` content. Also do not modify + ```` tags (previously ``src`` would be + overwritten, for no good reason). + * In :class:`formencode.validators.Email` allow single-character + domain names (like x.com). + * Make :class:`formencode.validators.FieldsMatch` give a normal + ``Invalid`` exception if you pass it a non-dictionary. Also treat + all missing keys as the empty string (previously the first key was + required and would raise KeyError). + * :class:`formencode.validators.Number` works with ``inf`` float + values (before it would raise a OverflowError). + * The ``tw`` locale has been renamed to the more standard ``zh_TW``. + * Added Japanese and Turkish translations. + * Fixed some outdated translations and errors in Spanish and Greek + translations. Translations now managed with `Babel + `_. +- 1.1 + * Fixed the ``is_empty()`` method in + :class:`formencode.validators.FieldStorageUploadConverter`; + previously it returned the opposite of the intended result. + * Added a parameter to ``htmlfill.render()``: ``prefix_error``. If + this parameter is true (the default) then errors automatically go + before the input field; if false then they go after the input field. + * Remove deprecated modules: ``fields``, ``formgen``, ``htmlform``, + ``sqlformgen``, and ``sqlschema``. + * Added ``formencode.htmlrename``, which renames HTML inputs. + * In ``formencode.htmlfill``, non-string values are compared usefully + (e.g., a select box with integer values). + * The validators ``Int`` and ``Number`` both take min/max arguments + (from Shannon Behrens). + * Validators based on ``formencode.validators.FormValidator`` will not + treat ``{}`` as an empty (unvalidated) value. + * Some adjustments to the URL validator. + * :class:`formencode.compound.All` does not handle empty values, + instead relying on sub-validators to check for emptiness. + * Fixed the ``if_missing`` attribute in + :class:`formencode.foreach.ForEach`; previously it would be the same + list instance, so if you modified it then it would effect future + ``if_missing`` values (reported by Felix Schwarz). + * Added formatter to :mod:`formencode.htmlfill`, so you can use + ```` -- this will + cause the error to be swallowed, not shown to the user. + * Added :class:`formencode.validators.XRI` for validation i-names, + i-numbers, URLs, etc (as used in OpenID). + * Look in ``/usr/share/locale`` for locale files, in addition to the + normal locations. + * Quiet Python 2.6 deprecation warnings. + * Fix :class:`formencode.validators.URL`, which was accepting illegal + characters (like newlines) and did not accept http://domain:PORT/ +- 1.0.1 + * ``chained_validators`` were removed from Schema somehow; now + replaced and working. + * Put in missing ``htmlfill.render(error_class=...)`` parameter (was + documented and implemented, but ``render()`` did not pass it + through). + +------------------------------------------------------------------- +Tue Nov 11 00:00:00 CET 2008 - cfarrell1980@gmail.com + +- try building with --record-rpm instead of --record - 1.0-1 + +------------------------------------------------------------------- +Wed Mar 19 00:00:00 CET 2008 - jfunk@funktronics.ca + +- Update to 1.0 + +------------------------------------------------------------------- +Thu Dec 27 00:00:00 CET 2007 - jfunk@funktronics.ca + +- Fix bad python interpreter path + +------------------------------------------------------------------- +Tue Dec 18 00:00:00 CET 2007 - jfunk@funktronics.ca + +- Update to 0.9: + - Backward incompatible changes + * The notion of "empty" has changed to include empty lists, + dictionaries, and tuples. If you get one of these values passed + into (or generated by) a validator with ``not_empty=True`` you can + get exceptions where you didn't previously. + - Enhancements + * Added support for Paste's MultiDict dictionary as input to + Schema.to_python, by converting it to a normal dict via MultiDict.mixed. + Previously MultiDicts wouldn't work with CompoundValidators (like + ForEach) + * Added encoding parameter to htmlfill, which will handle cases when mixed + str and unicode objects are used (turning all str objects into unicode) + * Include ``formencode.validators.InternationalPhoneNumber`` from + W-Mark Kubacki. + * ``validators.Int`` takes ``min`` and ``max`` options (from Felix + Schwarz). + * You can control the missing message (which by default is just + "Missing Value") using the message ``"missing"`` in a validator + (also from James Gardner). + * Added ``validators.CADR`` (for IP addresses with an optional range) + and ``validators.MACAddress`` (from Christoph Haas). + - Bug Fixes + * Be friendlier when loaded from a zip file (as with py2exe); + previously only egg zip files would work. + * Fixed bug in htmlfill when a document ends with no trailing text + after the last tag. + * Fix problem with HTMLParser's default unescaping routing, which only + understood a very limited number of entities in attribute values. + * Fix problem with looking up A records for email addresses. + * ``validators.String`` now always returns strings. It also converts + lists to comma-separated strings (no ``[...]``), and can encode + unicode if an ``encoding`` parameter is given. Empty values are + handled better. + * ``validators.UnicodeString`` properly handles non-Unicode inputs. + * Make ``validators.DateConverter`` serialize dates properly + (from James Gardner). + * Minor fix to setup.py to make FormEncode more friendly with + zc.buildout. + +------------------------------------------------------------------- +Mon Apr 23 00:00:00 CET 2007 - jfunk@funktronics.ca + +- Update to 0.7.1: + From 0.7.1: + * Set ``if_missing=()`` on ``validators.Set``, as a missing value + usually means empty for this value. + * Fix for ``Email`` validator that searches A records in addition to + MX records (from Jacob Smullyan). + * Fixes for the ``es`` locale. + From 0.7: + * **Backward compatibility issue**: Due to the addition of i18n + (internationalization) to FormEncode, Invalid exceptions now have + unicode messages. You may encounter unicode-related errors if you + are mixing these messages with non-ASCII ``str`` strings. + * gettext-enabled branch merged in + * Fixes `#1457145: Fails on URLs with port numbers + `_ + * Fixes `#1559918 Schema fails to accept unicode errors + `_ + * ``from formencode.validators import *`` will import the ``Invalid`` + exception now. + * ``Invalid().unpack_errors(encode_variables=True)`` now filters out + None values (which ``ForEach`` can produce even for keys with no + errors). + +------------------------------------------------------------------- +Mon Jan 08 00:00:00 CET 2007 - - poeml@suse.de + +- update to 0.6 + +------------------------------------------------------------------- +Mon Jun 26 00:00:00 CET 2006 - jfunk@funktronics.ca + +- Remove noarch + +------------------------------------------------------------------- +Fri Jun 23 00:00:00 CET 2006 - jfunk@funktronics.ca + +- No longer need pth kludge + +------------------------------------------------------------------- +Thu Jun 22 00:00:00 CET 2006 - jfunk@funktronics.ca + +- Update + +------------------------------------------------------------------- +Thu Oct 13 00:00:00 CET 2005 - jfunk@funktronics.ca + +- Initial release + + diff --git a/python-FormEncode.spec b/python-FormEncode.spec new file mode 100644 index 0000000..a533d42 --- /dev/null +++ b/python-FormEncode.spec @@ -0,0 +1,78 @@ +# +# spec file for package python-FormEncode +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-FormEncode +Version: 2.1.0 +Release: 0 +Summary: HTML form validation, generation, and conversion package +License: Python-2.0 +URL: https://formencode.org +Source: https://files.pythonhosted.org/packages/source/F/FormEncode/FormEncode-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#formencode/formencode#176 +Patch0: do-not-always-use-cgi-module.patch +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module dnspython} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pycountry} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +%python_subpackages + +%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. + +%prep +%autosetup -p1 -n FormEncode-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +# trick find-lang.sh into finding the translation files +%python_expand mv %{buildroot}%{$python_sitelib}/formencode/{i18n,locale} +%python_find_lang FormEncode +sed -i s/locale/i18n/ python*-FormEncode.lang +%python_expand mv %{buildroot}%{$python_sitelib}/formencode/{locale,i18n} +# remove misplaced documentation +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export LANG=en_US.UTF-8 +# excluded tests poll dns +donttest="(test_doctests and _wrapper-formencode.validators-False-True)" +donttest+=" or test_unicode_ascii_subgroup" +# 15.3 cannot fulfill test suite requirements with old versions; don't test on python2 +python2_flags="--version" +%pytest -k "not ($donttest)" ${$python_flags} + +%files %{python_files} -f %{python_prefix}-FormEncode.lang +%license LICENSE.txt +%doc README.rst +%{python_sitelib}/formencode +%{python_sitelib}/FormEncode-%{version}.dist-info + +%changelog