From 31f430ee166de2ae2b18bf7a7364443e15ecff67d12f7f7a3a24ab6c4984008f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 26 Feb 2019 08:52:26 +0000 Subject: [PATCH] Accepting request 679067 from home:jayvdb:coala:python3-bears - Fix Python 3 tests - Add py34-no-singledispatch.patch to remove unnecessary 'singledispatch' dependency, which is a backport from Python 3.4 - Update to v0.7.0 * Changes + Reflecting changes in RFC 8187 and RFC 8259, notices 1253 (bad charset) and 1281 (bad encoding for JSON) are now reported for all encodings other than UTF-8, and notice 1255 (ISO-8859-1 in Content-Disposition) has been removed. * Added + Checks for quoted commas and semicolons that might confuse a naive parser (notices 1299 and 1300). + New checks for Link headers according to RFC 8288 (notices 1307, 1308, and 1309). + Checks for immutable responses (notices 1301, 1302, and 1303). + Early hints are now recognized (due to their idiosyncratic semantics, they avoid many checks that are applied to all other responses). + Checks for the Accept-Post header (notice 1310). + Check for no Transfer-Encoding in response to HTTP/1.0 (notice 1306). + Check for 100 (Continue) before switching protocols (notice 1305). + Check that the sequence of responses to a request makes sense (notice 1304). + HAR files exported from Chrome and Insomnia are handled slightly better. * Fixed + Headers like Allow and Accept are now parsed more correctly (RFC Errata 5257). + gzip-encoded payloads are now decompressed more reliably. + When analyzing TCP streams, HTTPolice now uses a stricter heuristic for detecting HTTP/1.x streams, producing fewer spurious 1006/1009 notices. + Notice 1291 (Preference-Applied needs Vary) is no longer reported on responses to POST. - Use %license - Remove unnecessary build dependencies - Add more minimum versions OBS-URL: https://build.opensuse.org/request/show/679067 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-HTTPolice?expand=0&rev=1 --- .gitattributes | 23 ++++++++ .gitignore | 1 + HTTPolice-0.7.0.tar.gz | 3 + py34-no-singledispatch.patch | 110 +++++++++++++++++++++++++++++++++++ python-HTTPolice.changes | 43 ++++++++++++++ python-HTTPolice.spec | 81 ++++++++++++++++++++++++++ 6 files changed, 261 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 HTTPolice-0.7.0.tar.gz create mode 100644 py34-no-singledispatch.patch create mode 100644 python-HTTPolice.changes create mode 100644 python-HTTPolice.spec 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/HTTPolice-0.7.0.tar.gz b/HTTPolice-0.7.0.tar.gz new file mode 100644 index 0000000..84bcfc5 --- /dev/null +++ b/HTTPolice-0.7.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdb9fb7b7051c8736f850612c6d5c6572983ab2dc19b69e49407c226e6a9a2c7 +size 421804 diff --git a/py34-no-singledispatch.patch b/py34-no-singledispatch.patch new file mode 100644 index 0000000..72f573e --- /dev/null +++ b/py34-no-singledispatch.patch @@ -0,0 +1,110 @@ +From 4da2bde3d14a24b0623ee45ae10afd192d6fa771 Mon Sep 17 00:00:00 2001 +From: John Vandenberg +Date: Sat, 23 Feb 2019 16:54:20 +0700 +Subject: [PATCH] Use functools.singledispatch on Python 3.4+ + +singledispatch dependency is a backport of the Python 3.4+ +implementation of PEP 443 + +Closes https://github.com/vfaronov/httpolice/issues/6 +--- + httpolice/reports/common.py | 2 +- + httpolice/reports/html.py | 3 ++- + httpolice/reports/text.py | 2 +- + httpolice/util/moves.py | 5 +++++ + setup.py | 2 +- + 5 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/httpolice/reports/common.py b/httpolice/reports/common.py +index 7382851..fea50d8 100644 +--- a/httpolice/reports/common.py ++++ b/httpolice/reports/common.py +@@ -1,6 +1,5 @@ + # -*- coding: utf-8; -*- + +-from singledispatch import singledispatch + import six + + from httpolice import known, notice +@@ -8,6 +7,7 @@ + from httpolice.parse import ParseError, Symbol + from httpolice.structure import HeaderEntry, Parametrized + from httpolice.util.text import format_chars ++from httpolice.util.moves import singledispatch + + + def resolve_reference(ctx, path): +diff --git a/httpolice/reports/html.py b/httpolice/reports/html.py +index 9ba7f55..0e4f26f 100644 +--- a/httpolice/reports/html.py ++++ b/httpolice/reports/html.py +@@ -5,7 +5,7 @@ + import dominate + import dominate.tags as H + from dominate.util import text as text_node +-from singledispatch import singledispatch ++ + import six + + from httpolice import known, message, notice, structure +@@ -16,6 +16,7 @@ + find_reason_phrase, resolve_reference) + from httpolice.structure import Unavailable + from httpolice.util.text import nicely_join, printable ++from httpolice.util.moves import singledispatch + + + ############################################################################### +diff --git a/httpolice/reports/text.py b/httpolice/reports/text.py +index 243c812..62ceebf 100644 +--- a/httpolice/reports/text.py ++++ b/httpolice/reports/text.py +@@ -2,7 +2,6 @@ + + import codecs + +-from singledispatch import singledispatch + import six + + from httpolice import notice +@@ -10,6 +9,7 @@ + resolve_reference) + from httpolice.util.text import (detypographize, ellipsize, printable, + write_if_any) ++from httpolice.util.moves import singledispatch + + + def text_report(exchanges, buf): +diff --git a/httpolice/util/moves.py b/httpolice/util/moves.py +index 1cd93f9..630bfab 100644 +--- a/httpolice/util/moves.py ++++ b/httpolice/util/moves.py +@@ -13,3 +13,8 @@ + from urllib.parse import unquote_to_bytes + except ImportError: # Python 2; pragma: no cover + from urllib import unquote as unquote_to_bytes ++ ++try: # pragma: no cover ++ from functools import singledispatch ++except ImportError: # Python 2 backport; pragma: no cover ++ from singledispatch import singledispatch +diff --git a/setup.py b/setup.py +index b514760..fae8f83 100644 +--- a/setup.py ++++ b/setup.py +@@ -33,7 +33,6 @@ + # NB: when updating these fields, + # make sure you don't break ``tools/minimum_requires.sh``. + install_requires=[ +- 'singledispatch >= 3.4.0.3', + 'six >= 1.10.0', + 'lxml >= 4.1.0', + 'bitstring >= 3.1.4', +@@ -44,6 +43,7 @@ + extras_require={ + ':python_version == "2.7"': [ + 'enum34 >= 1.1.6', ++ 'singledispatch >= 3.4.0.3', + ], + }, + diff --git a/python-HTTPolice.changes b/python-HTTPolice.changes new file mode 100644 index 0000000..f35ba77 --- /dev/null +++ b/python-HTTPolice.changes @@ -0,0 +1,43 @@ +------------------------------------------------------------------- +Mon Feb 11 17:33:39 UTC 2019 - John Vandenberg + +- Fix Python 3 tests +- Add py34-no-singledispatch.patch to remove unnecessary 'singledispatch' + dependency, which is a backport from Python 3.4 +- Update to v0.7.0 + * Changes + + Reflecting changes in RFC 8187 and RFC 8259, + notices 1253 (bad charset) and 1281 (bad encoding for JSON) + are now reported for all encodings other than UTF-8, and + notice 1255 (ISO-8859-1 in Content-Disposition) has been removed. + * Added + + Checks for quoted commas and semicolons that might confuse a naive parser + (notices 1299 and 1300). + + New checks for Link headers according to RFC 8288 (notices 1307, + 1308, and 1309). + + Checks for immutable responses (notices 1301, 1302, and 1303). + + Early hints are now recognized (due to their idiosyncratic semantics, + they avoid many checks that are applied to all other responses). + + Checks for the Accept-Post header (notice 1310). + + Check for no Transfer-Encoding in response to HTTP/1.0 (notice 1306). + + Check for 100 (Continue) before switching protocols (notice 1305). + + Check that the sequence of responses to a request makes sense + (notice 1304). + + HAR files exported from Chrome and Insomnia are handled slightly better. + * Fixed + + Headers like Allow and Accept are now parsed more correctly + (RFC Errata 5257). + + gzip-encoded payloads are now decompressed more reliably. + + When analyzing TCP streams, HTTPolice now uses a stricter heuristic + for detecting HTTP/1.x streams, producing fewer spurious 1006/1009 + notices. + + Notice 1291 (Preference-Applied needs Vary) is no longer reported + on responses to POST. +- Use %license +- Remove unnecessary build dependencies +- Add more minimum versions + +------------------------------------------------------------------- +Thu Nov 16 17:45:04 UTC 2017 - toddrme2178@gmail.com + +- Initial version diff --git a/python-HTTPolice.spec b/python-HTTPolice.spec new file mode 100644 index 0000000..e301fdc --- /dev/null +++ b/python-HTTPolice.spec @@ -0,0 +1,81 @@ +# +# spec file for package python-HTTPolice +# +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# +# 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 http://bugs.opensuse.org/ + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-HTTPolice +Version: 0.7.0 +Release: 0 +License: MIT +Summary: Validator for HTTP +Url: https://github.com/vfaronov/httpolice +Group: Development/Languages/Python +Source: https://files.pythonhosted.org/packages/source/H/HTTPolice/HTTPolice-%{version}.tar.gz +Patch0: https://github.com/vfaronov/httpolice/commit/4da2bde.patch#/py34-no-singledispatch.patch +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildRequires: %{python_module bitstring >= 3.1.4} +BuildRequires: %{python_module brotlipy >= 0.5.1} +BuildRequires: %{python_module defusedxml >= 0.5.0} +BuildRequires: %{python_module dominate >= 2.2.0} +BuildRequires: %{python_module lxml >= 3.6.0} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module six >= 1.10.0} +BuildRequires: python2-singledispatch >= 3.4.0.3 +BuildRequires: python-enum34 >= 1.1.6 +Requires: python-bitstring >= 3.1.4 +Requires: python-brotlipy >= 0.5.1 +Requires: python-defusedxml >= 0.5.0 +Requires: python-dominate >= 2.2.0 +Requires: python-lxml >= 3.6.0 +Requires: python-six >= 1.10.0 +%ifpython2 +Requires: python-enum34 >= 1.1.6 +Requires: python-singledispatch >= 3.4.0.3 +%endif +BuildArch: noarch + +%python_subpackages + +%description +HTTPolice is a validator or linter for HTTP requests and responses. +It can spot bad header syntax, inappropriate status codes, and other potential +problems in your HTTP server or client. + +%prep +%setup -q -n HTTPolice-%{version} +%patch0 -p1 + +%build +export LANG=en_US.UTF-8 +%python_build + +%install +export LANG=en_US.UTF-8 +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export LANG=en_US.UTF-8 +%python_exec -m pytest -o addopts=-v + +%files %{python_files} +%license LICENSE.txt +%doc CHANGELOG.rst README.rst +%python3_only %{_bindir}/httpolice +%{python_sitelib}/* + +%changelog