diff options
author | Stuart Prescott <stuart@debian.org> | 2022-12-02 11:49:44 +0000 |
---|---|---|
committer | Stuart Prescott <stuart@debian.org> | 2022-12-02 11:49:44 +0000 |
commit | 3626b823228a3c82842c9344331f375e9a9ef482 (patch) | |
tree | 1d91e2213bde4dbf7a0a9e8dea04d31f41e598bc | |
parent | 3121485314e1e5899dcf73ded5ac97f08c77612a (diff) | |
parent | 6cd7b2083c2de8069236d7a738b17b70c5b78ec6 (diff) |
Record python-wadllib (1.3.6-3) in archive suite sid
28 files changed, 401 insertions, 329 deletions
diff --git a/HACKING.txt b/HACKING.rst index 37da9a6..b62d0f2 100644 --- a/HACKING.txt +++ b/HACKING.rst @@ -13,16 +13,11 @@ You should have received a copy of the GNU Lesser General Public License along with wadllib. If not, see <http://www.gnu.org/licenses/>. -This project uses zc.buildout for development. - ============ Introduction ============ -These are guidelines for hacking on the wadllib project. But first, -please see the common hacking guidelines at: - - http://dev.launchpad.net/Hacking +To run this project's tests, use `tox <https://tox.readthedocs.io/en/latest/>`. Getting help diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 23641e8..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -recursive-include src *.json *.xml *.txt -include ez_setup.py -include COPYING.txt HACKING.txt diff --git a/src/wadllib/NEWS.txt b/NEWS.rst index 55aae4c..f619422 100644 --- a/src/wadllib/NEWS.txt +++ b/NEWS.rst @@ -2,6 +2,20 @@ NEWS for wadllib ================ +1.3.6 (2021-09-13) +================== + +- Remove buildout support in favour of tox. [bug=922605] +- Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + +1.3.5 (2021-01-20) +================== + +- Drop support for Python 3.2, 3.3, and 3.4. +- Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + 1.3.4 (2020-04-29) ================== @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: wadllib -Version: 1.3.4 +Version: 1.3.6 Summary: Navigate HTTP resources using WADL files as guides. Home-page: https://launchpad.net/wadllib Maintainer: LAZR Developers @@ -581,13 +581,6 @@ Description: .. >>> import cgi >>> import io >>> def assert_message_parts(media_type, doc, expected): - ... if sys.version_info[0] == 3 and sys.version_info[1] < 3: - ... # We can't do much due to https://bugs.python.org/issue18013. - ... for value in expected: - ... if not isinstance(value, bytes): - ... value = value.encode('UTF-8') - ... assert value in doc - ... return ... environ = { ... 'REQUEST_METHOD': 'POST', ... 'CONTENT_TYPE': media_type, @@ -618,6 +611,13 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text", binary_field=b"\x01\x02\r\x81\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts(media_type, doc, ['text', b'\x01\x02\r\x81\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\n", binary_field=b"\x01\x02\r\x81\n\r") >>> print(media_type) multipart/form-data; boundary=... @@ -626,6 +626,14 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text\n", binary_field=b"\x01\x02\r\x81\n\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\n', b'\x01\x02\r\x81\n\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\r\nmore\r\n", ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") >>> print(media_type) @@ -633,6 +641,15 @@ Description: .. >>> assert_message_parts( ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( + ... text_field=u"text\r\nmore\r\n", + ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'text/unknown') >>> method.build_representation(field="value") Traceback (most recent call last): @@ -700,6 +717,20 @@ Description: .. NEWS for wadllib ================ + 1.3.6 (2021-09-13) + ================== + + - Remove buildout support in favour of tox. [bug=922605] + - Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + + 1.3.5 (2021-01-20) + ================== + + - Drop support for Python 3.2, 3.3, and 3.4. + - Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + 1.3.4 (2020-04-29) ================== @@ -825,9 +856,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 diff --git a/debian/changelog b/debian/changelog index 4adb168..6098c48 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,51 @@ +python-wadllib (1.3.6-3) unstable; urgency=medium + + * Team Upload. + * Permit stderr in autopkgtest test (Closes: #1025178). + + -- Stuart Prescott <stuart@debian.org> Fri, 02 Dec 2022 22:49:44 +1100 + +python-wadllib (1.3.6-2) unstable; urgency=medium + + [ Debian Janitor ] + * Remove constraints unnecessary since buster: + + Build-Depends: Drop versioned constraint on python3-all. + * Update standards version to 4.6.1, no changes needed. + + [ Stefano Rivera ] + * Support the nocheck build profile. + + -- Stefano Rivera <stefanor@debian.org> Tue, 18 Oct 2022 17:46:43 +0200 + +python-wadllib (1.3.6-1) unstable; urgency=medium + + * New upstream release. + * Bump Standards-Version to 4.6.0, no changes needed. + * Bump debhelper compat level to 13. + * Add link to Changelog in UMEGAYA. + * Patch: Include docs in the installed tree, for doctest autopkgtests. + * Run the test suite as autopkgtests. + * Update paths to README and NEWS. + + -- Stefano Rivera <stefanor@debian.org> Fri, 17 Sep 2021 12:37:12 -0700 + +python-wadllib (1.3.5-1) unstable; urgency=medium + + [ Stefano Rivera ] + * New upstream release. + * d/control: Update Uploaders field with new Debian Python Team + contact address. + * Update upstream metadata. + * Bump Standards-Version to 4.5.1, no changes needed. + * Bump copyright years. + * Bump watch format version to 4. + + [ Ondřej Nový ] + * d/control: Update Vcs-* fields with new Debian Python Team Salsa + layout. + + -- Stefano Rivera <stefanor@debian.org> Thu, 21 Jan 2021 23:43:58 -0700 + python-wadllib (1.3.4-1) unstable; urgency=medium * Team upload. diff --git a/debian/control b/debian/control index 33cc525..f8c9a4d 100644 --- a/debian/control +++ b/debian/control @@ -2,20 +2,18 @@ Source: python-wadllib Section: python Priority: optional Maintainer: Stefano Rivera <stefanor@debian.org> -Uploaders: - Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> +Uploaders: Debian Python Team <team+python@tracker.debian.org> Build-Depends: - debhelper-compat (= 12), + debhelper-compat (= 13), dh-python, - python3-all (>= 3.1.2-6~), - python3-lazr.uri, + python3-all, + python3-lazr.uri <!nocheck>, python3-setuptools -Standards-Version: 4.2.1 +Standards-Version: 4.6.1 Homepage: https://launchpad.net/wadllib -Vcs-Git: https://salsa.debian.org/python-team/modules/python-wadllib.git -Vcs-Browser: https://salsa.debian.org/python-team/modules/python-wadllib +Vcs-Git: https://salsa.debian.org/python-team/packages/python-wadllib.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-wadllib Rules-Requires-Root: no -Testsuite: autopkgtest-pkg-python Package: python3-wadllib Architecture: all diff --git a/debian/copyright b/debian/copyright index 2c744ac..38e00bd 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,14 +3,14 @@ Upstream-Name: wadllib Source: https://launchpad.net/wadllib Files: * -Copyright: 2008-2018 Canonical Ltd. +Copyright: 2008-2021 Canonical Ltd. License: LGPL-3.0 Files: debian/* Copyright: 2009, James Westby <james.westby@ubuntu.com> 2009-2011, Luca Falavigna <dktrkranz@debian.org> - 2012-2018, Stefano Rivera <stefanor@debian.org> + 2012-2021, Stefano Rivera <stefanor@debian.org> License: LGPL-3.0 License: LGPL-3.0 diff --git a/debian/patches/include-docs b/debian/patches/include-docs new file mode 100644 index 0000000..1ad220e --- /dev/null +++ b/debian/patches/include-docs @@ -0,0 +1,22 @@ +From: Stefano Rivera <stefanor@debian.org> +Date: Fri, 17 Sep 2021 12:05:19 -0700 +Subject: Include docs in package data (for doctests) + +Forwarded: https://code.launchpad.net/~stefanor/wadllib/install-docs/+merge/408835 +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index a9d35d4..a51416f 100755 +--- a/setup.py ++++ b/setup.py +@@ -53,7 +53,7 @@ setup( + packages=find_packages('src'), + package_dir={'':'src'}, + package_data={ +- '': ['*.xml', '*.json'], ++ '': ['*.xml', '*.json', '*.rst'], + }, + include_package_data=True, + zip_safe=False, diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..670b7e9 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +include-docs diff --git a/debian/python3-wadllib.docs b/debian/python3-wadllib.docs index 0f9b0e7..a1320b1 100644 --- a/debian/python3-wadllib.docs +++ b/debian/python3-wadllib.docs @@ -1 +1 @@ -src/wadllib/README.txt +README.rst diff --git a/debian/rules b/debian/rules index 019e5ef..5d75c1b 100755 --- a/debian/rules +++ b/debian/rules @@ -6,4 +6,4 @@ export PYBUILD_NAME=wadllib dh $@ --with python3 --buildsystem pybuild override_dh_installchangelogs: - dh_installchangelogs -k src/wadllib/NEWS.txt + dh_installchangelogs -k NEWS.rst diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..f40db0b --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: py3 +Depends: python3-all, python3-wadllib, python3-zope.testrunner +Restrictions: allow-stderr diff --git a/debian/tests/py3 b/debian/tests/py3 new file mode 100755 index 0000000..681d537 --- /dev/null +++ b/debian/tests/py3 @@ -0,0 +1,7 @@ +#!/bin/sh +set -euf +for py in $(py3versions -s); do + echo "===== $py =====" + $py -m zope.testrunner -vv -s wadllib.tests \ + --test-path /usr/lib/python3/dist-packages/ +done diff --git a/debian/upstream/metadata b/debian/upstream/metadata index 4bcba5f..3f60608 100644 --- a/debian/upstream/metadata +++ b/debian/upstream/metadata @@ -1,2 +1,9 @@ +--- +Bug-Database: https://bugs.launchpad.net/wadllib +Bug-Submit: https://bugs.launchpad.net/wadllib/+filebug +Changelog: https://bazaar.launchpad.net/~lazr-developers/wadllib/trunk/view/head:/NEWS.rst +Registry: + - Name: PyPI + Entry: wadllib Repository: https://code.launchpad.net/wadllib -Repository-Browse: https://code.launchpad.net/wadllib +Repository-Browse: https://bazaar.launchpad.net/~lazr-developers/wadllib/trunk/files diff --git a/debian/watch b/debian/watch index 36a3f0b..1f24e82 100644 --- a/debian/watch +++ b/debian/watch @@ -1,2 +1,2 @@ -version=3 +version=4 https://launchpad.net/wadllib/+download .*/wadllib-(.+).tar.gz diff --git a/ez_setup.py b/ez_setup.py deleted file mode 100644 index 6e0aae4..0000000 --- a/ez_setup.py +++ /dev/null @@ -1,241 +0,0 @@ -#!python -"""Bootstrap setuptools installation - -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - - from ez_setup import use_setuptools - use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. -""" -import sys -DEFAULT_VERSION = "0.6c11" -DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] - -md5_data = { - 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', - 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', - 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', - 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', - 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', - 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', - 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', - 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', - 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', - 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', - 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', - 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', - 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', - 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', - 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', - 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', - 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', - 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', - 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', - 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', - 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', - 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', - 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', - 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', - 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', - 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', - 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', - 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', - 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', - 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', -} - -import sys, os - -def _validate_md5(egg_name, data): - if egg_name in md5_data: - from md5 import md5 - digest = md5(data).hexdigest() - if digest != md5_data[egg_name]: - print >>sys.stderr, ( - "md5 validation of %s failed! (Possible download problem?)" - % egg_name - ) - sys.exit(2) - return data - - -def use_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - download_delay=15, min_version=None -): - """Automatically find/download setuptools and make it available on sys.path - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end with - a '/'). `to_dir` is the directory where setuptools will be downloaded, if - it is not already available. If `download_delay` is specified, it should - be the number of seconds that will be paused before initiating a download, - should one be required. If an older version of setuptools is installed, - this routine will print a message to ``sys.stderr`` and raise SystemExit in - an attempt to abort the calling script. - """ - # Work around a hack in the ez_setup.py file from simplejson==1.7.3. - if min_version: - version = min_version - - was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules - def do_download(): - egg = download_setuptools(version, download_base, to_dir, download_delay) - sys.path.insert(0, egg) - import setuptools; setuptools.bootstrap_install_from = egg - try: - import pkg_resources - except ImportError: - return do_download() - try: - pkg_resources.require("setuptools>="+version); return - except pkg_resources.VersionConflict, e: - if was_imported: - print >>sys.stderr, ( - "The required version of setuptools (>=%s) is not available, and\n" - "can't be installed while this script is running. Please install\n" - " a more recent version first, using 'easy_install -U setuptools'." - "\n\n(Currently using %r)" - ) % (version, e.args[0]) - sys.exit(2) - else: - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return do_download() - except pkg_resources.DistributionNotFound: - return do_download() - -def download_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - delay = 15 -): - """Download setuptools from a specified location and return its filename - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end - with a '/'). `to_dir` is the directory where the egg will be downloaded. - `delay` is the number of seconds to pause before an actual download attempt. - """ - import urllib2, shutil - egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) - url = download_base + egg_name - saveto = os.path.join(to_dir, egg_name) - src = dst = None - if not os.path.exists(saveto): # Avoid repeated downloads - try: - from distutils import log - if delay: - log.warn(""" ---------------------------------------------------------------------------- -This script requires setuptools version %s to run (even to display -help). I will attempt to download it for you (from -%s), but -you may need to enable firewall access for this script first. -I will start the download in %d seconds. - -(Note: if this machine does not have network access, please obtain the file - - %s - -and place it in this directory before rerunning this script.) ----------------------------------------------------------------------------""", - version, download_base, delay, url - ); from time import sleep; sleep(delay) - log.warn("Downloading %s", url) - src = urllib2.urlopen(url) - # Read/write all in one block, so we don't create a corrupt file - # if the download is interrupted. - data = _validate_md5(egg_name, src.read()) - dst = open(saveto,"wb"); dst.write(data) - finally: - if src: src.close() - if dst: dst.close() - return os.path.realpath(saveto) - -def main(argv, version=DEFAULT_VERSION): - """Install or upgrade setuptools and EasyInstall""" - try: - import setuptools - except ImportError: - egg = None - try: - egg = download_setuptools(version, delay=0) - sys.path.insert(0,egg) - from setuptools.command.easy_install import main - return main(list(argv)+[egg]) # we're done here - finally: - if egg and os.path.exists(egg): - os.unlink(egg) - else: - if setuptools.__version__ == '0.0.1': - print >>sys.stderr, ( - "You have an obsolete version of setuptools installed. Please\n" - "remove it from your system entirely before rerunning this script." - ) - sys.exit(2) - - req = "setuptools>="+version - import pkg_resources - try: - pkg_resources.require(req) - except pkg_resources.VersionConflict: - try: - from setuptools.command.easy_install import main - except ImportError: - from easy_install import main - main(list(argv)+[download_setuptools(delay=0)]) - sys.exit(0) # try to force an exit - else: - if argv: - from setuptools.command.easy_install import main - main(argv) - else: - print "Setuptools version",version,"or greater has been installed." - print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' - -def update_md5(filenames): - """Update our built-in md5 registry""" - - import re - from md5 import md5 - - for name in filenames: - base = os.path.basename(name) - f = open(name,'rb') - md5_data[base] = md5(f.read()).hexdigest() - f.close() - - data = [" %r: %r,\n" % it for it in md5_data.items()] - data.sort() - repl = "".join(data) - - import inspect - srcfile = inspect.getsourcefile(sys.modules[__name__]) - f = open(srcfile, 'rb'); src = f.read(); f.close() - - match = re.search("\nmd5_data = {\n([^}]+)}", src) - if not match: - print >>sys.stderr, "Internal error!" - sys.exit(2) - - src = src[:match.start(1)] + repl + src[match.end(1):] - f = open(srcfile,'w') - f.write(src) - f.close() - - -if __name__=='__main__': - if len(sys.argv)>2 and sys.argv[1]=='--md5update': - update_md5(sys.argv[2:]) - else: - main(sys.argv[1:]) - - - - - @@ -29,7 +29,7 @@ def generate(*docname_or_string): marker = '.. pypi description ends here' res = [] for value in docname_or_string: - if value.endswith('.txt'): + if value.endswith('.rst'): with open(value) as f: value = f.read() idx = value.find(marker) @@ -41,30 +41,28 @@ def generate(*docname_or_string): return '\n'.join(res) # end generic helpers -__version__ = open("src/wadllib/version.txt").read().strip() - install_requires = [ - 'setuptools', + 'importlib-metadata; python_version < "3.8"', 'lazr.uri', + 'setuptools', ] setup( name='wadllib', - version=__version__, + version='1.3.6', packages=find_packages('src'), package_dir={'':'src'}, package_data={ - 'wadllib': ['version.txt'], - '': ['*.xml', '*.json'], + '': ['*.xml', '*.json', '*.rst'], }, include_package_data=True, zip_safe=False, maintainer='LAZR Developers', maintainer_email='lazr-developers@lists.launchpad.net', - description=open('README.txt').readline().strip(), + description=open('README.rst').readline().strip(), long_description=generate( - 'src/wadllib/README.txt', - 'src/wadllib/NEWS.txt'), + 'src/wadllib/docs/index.rst', + 'NEWS.rst'), license='LGPL v3', install_requires=install_requires, url='https://launchpad.net/wadllib', @@ -78,17 +76,13 @@ setup( "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.2", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", ], extras_require=dict( - docs=['Sphinx', - 'z3c.recipe.sphinxdoc'] + docs=['Sphinx'], ), test_suite='wadllib.tests', ) diff --git a/src/wadllib.egg-info/PKG-INFO b/src/wadllib.egg-info/PKG-INFO index 3fe10f6..ad3aba1 100644 --- a/src/wadllib.egg-info/PKG-INFO +++ b/src/wadllib.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: wadllib -Version: 1.3.4 +Version: 1.3.6 Summary: Navigate HTTP resources using WADL files as guides. Home-page: https://launchpad.net/wadllib Maintainer: LAZR Developers @@ -581,13 +581,6 @@ Description: .. >>> import cgi >>> import io >>> def assert_message_parts(media_type, doc, expected): - ... if sys.version_info[0] == 3 and sys.version_info[1] < 3: - ... # We can't do much due to https://bugs.python.org/issue18013. - ... for value in expected: - ... if not isinstance(value, bytes): - ... value = value.encode('UTF-8') - ... assert value in doc - ... return ... environ = { ... 'REQUEST_METHOD': 'POST', ... 'CONTENT_TYPE': media_type, @@ -618,6 +611,13 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text", binary_field=b"\x01\x02\r\x81\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts(media_type, doc, ['text', b'\x01\x02\r\x81\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\n", binary_field=b"\x01\x02\r\x81\n\r") >>> print(media_type) multipart/form-data; boundary=... @@ -626,6 +626,14 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text\n", binary_field=b"\x01\x02\r\x81\n\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\n', b'\x01\x02\r\x81\n\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\r\nmore\r\n", ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") >>> print(media_type) @@ -633,6 +641,15 @@ Description: .. >>> assert_message_parts( ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( + ... text_field=u"text\r\nmore\r\n", + ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'text/unknown') >>> method.build_representation(field="value") Traceback (most recent call last): @@ -700,6 +717,20 @@ Description: .. NEWS for wadllib ================ + 1.3.6 (2021-09-13) + ================== + + - Remove buildout support in favour of tox. [bug=922605] + - Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + + 1.3.5 (2021-01-20) + ================== + + - Drop support for Python 3.2, 3.3, and 3.4. + - Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + 1.3.4 (2020-04-29) ================== @@ -825,9 +856,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 diff --git a/src/wadllib.egg-info/SOURCES.txt b/src/wadllib.egg-info/SOURCES.txt index 3cbef34..0c64825 100644 --- a/src/wadllib.egg-info/SOURCES.txt +++ b/src/wadllib.egg-info/SOURCES.txt @@ -1,21 +1,20 @@ COPYING.txt -HACKING.txt -MANIFEST.in -README.txt -ez_setup.py +HACKING.rst +NEWS.rst +README.rst setup.py -src/wadllib/NEWS.txt -src/wadllib/README.txt src/wadllib/__init__.py src/wadllib/application.py src/wadllib/iso_strptime.py -src/wadllib/version.txt src/wadllib.egg-info/PKG-INFO src/wadllib.egg-info/SOURCES.txt src/wadllib.egg-info/dependency_links.txt src/wadllib.egg-info/not-zip-safe src/wadllib.egg-info/requires.txt src/wadllib.egg-info/top_level.txt +src/wadllib/docs/Makefile +src/wadllib/docs/NEWS.rst +src/wadllib/docs/index.rst src/wadllib/tests/__init__.py src/wadllib/tests/test_docs.py src/wadllib/tests/data/__init__.py diff --git a/src/wadllib.egg-info/requires.txt b/src/wadllib.egg-info/requires.txt index f0506a0..b479605 100644 --- a/src/wadllib.egg-info/requires.txt +++ b/src/wadllib.egg-info/requires.txt @@ -1,6 +1,8 @@ lazr.uri setuptools +[:python_version < "3.8"] +importlib-metadata + [docs] Sphinx -z3c.recipe.sphinxdoc diff --git a/src/wadllib/__init__.py b/src/wadllib/__init__.py index b50e2b6..3a9845c 100644 --- a/src/wadllib/__init__.py +++ b/src/wadllib/__init__.py @@ -17,9 +17,12 @@ import sys -import pkg_resources -__version__ = pkg_resources.resource_string( - "wadllib", "version.txt").strip() +try: + import importlib.metadata as importlib_metadata +except ImportError: + import importlib_metadata + +__version__ = importlib_metadata.version("wadllib") if sys.version_info[0] >= 3: _string_types = str diff --git a/src/wadllib/application.py b/src/wadllib/application.py index 107d9e4..06a4398 100644 --- a/src/wadllib/application.py +++ b/src/wadllib/application.py @@ -880,8 +880,9 @@ class RepresentationDefinition(WADLResolvableDefinition, HasParametersMixin): raise TypeError('bytes payload expected: %s' % type(value)) buf.write(value) else: - if not isinstance(value, str): - raise TypeError('str payload expected: %s' % type(value)) + if not isinstance(value, _string_types): + raise TypeError( + 'string payload expected: %s' % type(value)) lines = re.split(r'\r\n|\r|\n', value) for line in lines[:-1]: buf.write(line.encode('UTF-8')) diff --git a/src/wadllib/docs/Makefile b/src/wadllib/docs/Makefile new file mode 100644 index 0000000..8cbdfa0 --- /dev/null +++ b/src/wadllib/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = wadllib +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/src/wadllib/docs/NEWS.rst b/src/wadllib/docs/NEWS.rst new file mode 100644 index 0000000..f619422 --- /dev/null +++ b/src/wadllib/docs/NEWS.rst @@ -0,0 +1,133 @@ +================ +NEWS for wadllib +================ + +1.3.6 (2021-09-13) +================== + +- Remove buildout support in favour of tox. [bug=922605] +- Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + +1.3.5 (2021-01-20) +================== + +- Drop support for Python 3.2, 3.3, and 3.4. +- Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + +1.3.4 (2020-04-29) +================== + +- Advertise support for Python 3.8. +- Add Python 3.9 compatibility by using xml.etree.ElementTree if + xml.etree.cElementTree does not exist. [bug=1870294] + +1.3.3 (2018-07-20) +================== + +- Drop support for Python < 2.6. +- Add tox testing support. +- Implement a subset of MIME multipart/form-data encoding locally rather + than using the standard library's email module, which doesn't have good + handling of binary parts and corrupts bytes in them that look like line + endings in various ways depending on the Python version. [bug=1729754] + +1.3.2 (2013-02-25) +================== + +- Impose sort order to avoid test failures due to hash randomization. + LP: #1132125 +- Be sure to close streams opened by pkg_resources.resource_stream() to avoid + test suite complaints. + + +1.3.1 (2012-03-22) +================== + +- Correct the double pass through _from_string causing datetime issues + + +1.3.0 (2012-01-27) +================== + +- Add Python 3 compatibility + +- Add the ability to inspect links before following them. + +- Ensure that the sample data is packaged. + +1.2.0 (2011-02-03) +================== + +- It's now possible to examine a link before following it, to see + whether it has a WADL description or whether it needs to be fetched + with a general HTTP client. + +- It's now possible to iterate over a resource's Parameter objects + with the .parameters() method. + +1.1.8 (2010-10-27) +================== + +- This revision contains no code changes, but the build system was + changed (yet again). This time to include the version.txt file + used by setup.py. + +1.1.7 (2010-10-26) +================== + +- This revision contains no code changes, but the build system was + changed (again) to include the sample data used in tests. + +1.1.6 (2010-10-21) +================== + +- This revision contains no code changes, but the build system was + changed to include the sample data used in tests. + +1.1.5 (2010-05-04) +================== + +- Fixed a bug (Launchpad bug 274074) that prevented the lookup of + parameter values in resources associated directly with a + representation definition (rather than a resource type with a + representation definition). Bug fix provided by James Westby. + +1.1.4 (2009-09-15) +================== + +- Fixed a bug that crashed wadllib unless all parameters of a + multipart representation were provided. + +1.1.3 (2009-08-26) +================== + +- Remove unnecessary build dependencies. + +- Add missing dependencies to setup file. + +- Remove sys.path hack from setup.py. + +1.1.2 (2009-08-20) +================== + +- Consistently handle different versions of simplejson. + +1.1.1 (2009-07-14) +================== + +- Make wadllib aware of the <option> tags that go beneath <param> tags. + +1.1 (2009-07-09) +================ + +- Make wadllib capable of recognizing and generating + multipart/form-data representations, including representations that + incorporate binary parameters. + + +1.0 (2009-03-23) +================ + +- Initial release on PyPI diff --git a/src/wadllib/README.txt b/src/wadllib/docs/index.rst index f4d7fd7..c86faca 100644 --- a/src/wadllib/README.txt +++ b/src/wadllib/docs/index.rst @@ -572,13 +572,6 @@ zope.publisher would. >>> import cgi >>> import io >>> def assert_message_parts(media_type, doc, expected): - ... if sys.version_info[0] == 3 and sys.version_info[1] < 3: - ... # We can't do much due to https://bugs.python.org/issue18013. - ... for value in expected: - ... if not isinstance(value, bytes): - ... value = value.encode('UTF-8') - ... assert value in doc - ... return ... environ = { ... 'REQUEST_METHOD': 'POST', ... 'CONTENT_TYPE': media_type, @@ -609,6 +602,13 @@ zope.publisher would. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text", binary_field=b"\x01\x02\r\x81\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts(media_type, doc, ['text', b'\x01\x02\r\x81\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\n", binary_field=b"\x01\x02\r\x81\n\r") >>> print(media_type) multipart/form-data; boundary=... @@ -617,6 +617,14 @@ zope.publisher would. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text\n", binary_field=b"\x01\x02\r\x81\n\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\n', b'\x01\x02\r\x81\n\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\r\nmore\r\n", ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") >>> print(media_type) @@ -624,6 +632,15 @@ zope.publisher would. >>> assert_message_parts( ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( + ... text_field=u"text\r\nmore\r\n", + ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'text/unknown') >>> method.build_representation(field="value") Traceback (most recent call last): @@ -691,5 +708,4 @@ match any defined method. .. toctree:: :glob: - * - docs/* + NEWS diff --git a/src/wadllib/tests/test_docs.py b/src/wadllib/tests/test_docs.py index 9cc7b89..b4f3a50 100644 --- a/src/wadllib/tests/test_docs.py +++ b/src/wadllib/tests/test_docs.py @@ -38,12 +38,10 @@ DOCTEST_FLAGS = ( def load_tests(loader, tests, pattern): - doctest_files = [ - os.path.abspath( - pkg_resources.resource_filename('wadllib', 'README.txt'))] + doctest_files = [] if pkg_resources.resource_exists('wadllib', 'docs'): for name in pkg_resources.resource_listdir('wadllib', 'docs'): - if name.endswith('.txt'): + if name.endswith('.rst'): doctest_files.append( os.path.abspath( pkg_resources.resource_filename( diff --git a/src/wadllib/version.txt b/src/wadllib/version.txt deleted file mode 100644 index d0149fe..0000000 --- a/src/wadllib/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.3.4 |