[Pkg-freeipa-devel] [Git][freeipa-team/python-kdcproxy][master] 18 commits: Properly handle missing Content-Length
Timo Aaltonen
gitlab at salsa.debian.org
Sat Aug 4 09:22:38 BST 2018
Timo Aaltonen pushed to branch master at FreeIPA packaging / python-kdcproxy
Commits:
5edbbeb7 by Nathaniel McCallum at 2015-08-03T20:52:14Z
Properly handle missing Content-Length
- - - - -
d9923b58 by Christian Heimes at 2017-01-04T15:38:47Z
Fix tests
Python 2's mock is no longer compatible to more recent versions of
Python's socket module. Tests are still fine without the autospec
feature.
More recent versions of pytests refuse to load tests because pytest
considers webtest.TestApp as a test class with a non-trival __init__.
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
5ed2ab9d by Christian Heimes at 2017-01-04T15:50:29Z
Fix PEP8 violations
Recent versions of flake8 became more strict.
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
84a83297 by Christian Heimes at 2017-01-04T15:50:29Z
Port setup.py and tox to setuptools
Let's use setuptools to build and distribute kdcproxy. This gives us
wheel packages and nicer dependency management. The special case for
setuptools < 18.0 is required for old installations.
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
07f5204a by Christian Heimes at 2017-01-04T15:52:55Z
Add Travis CI configuration
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
483c00d0 by Mark Schreiber at 2017-01-04T16:02:38Z
Eliminate import error message
Avoid logging an error message due to a failing import. Key the
attempted import off the Python version rather than trying, failing, and
falling back.
- - - - -
55034d6b by Nathaniel McCallum at 2017-01-04T16:33:31Z
Fix some pep8 issues
Signed-off-by: Nathaniel McCallum <npmccallum at redhat.com>
- - - - -
881e3ec1 by Christian Heimes at 2017-01-19T12:54:24Z
Prepare 0.3.3
kdcproxy is now official stable and supports 3.5 and 3.6.
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
d2a2e11a by Christian Heimes at 2017-01-19T13:17:10Z
typo, I forgot a trailing comma
Signed-off-by: Christian Heimes <cheimes at redhat.com>
- - - - -
272bedb8 by Timo Aaltonen at 2017-12-24T09:36:02Z
import 0.3.2-5
- - - - -
20aeaa96 by Timo Aaltonen at 2017-12-24T09:36:14Z
Merge branch 'upstream'
- - - - -
99394bc6 by Timo Aaltonen at 2017-12-24T09:37:11Z
update urls
- - - - -
c246bc3b by Timo Aaltonen at 2017-12-24T09:42:15Z
Bump debhelper to 10.
- - - - -
efb8adf2 by Timo Aaltonen at 2017-12-24T09:46:52Z
Remove obsolete patches.
- - - - -
d8651a72 by Timo Aaltonen at 2017-12-24T09:49:22Z
control: Add python-setuptools to build-depends.
- - - - -
9b5a4ff8 by Timo Aaltonen at 2017-12-24T09:50:13Z
rules: Override dh_clean.
- - - - -
9a8bbd46 by Timo Aaltonen at 2017-12-24T09:51:36Z
control: Bump policy to 4.1.2, no changes.
- - - - -
3712f23a by Timo Aaltonen at 2017-12-24T09:51:45Z
releasing package python-kdcproxy version 0.3.3-1
- - - - -
20 changed files:
- .gitignore
- + .travis.yml
- MANIFEST.in
- debian/changelog
- debian/compat
- debian/control
- debian/copyright
- − debian/patches/fix-coverage.diff
- debian/patches/series
- − debian/patches/workaround-mock-bug.diff
- + debian/python-kdcproxy.docs
- + debian/python3-kdcproxy.docs
- debian/rules
- debian/watch
- kdcproxy/__init__.py
- kdcproxy/config/mit.py
- + setup.cfg
- setup.py
- tests.py
- tox.ini
Changes:
=====================================
.gitignore
=====================================
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ __pycache__
/dist
/build
/MANIFEST
+/*.egg-info
+/.cache
=====================================
.travis.yml
=====================================
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+sudo: false
+
+language: python
+
+cache: pip
+
+matrix:
+ include:
+ - python: 2.7
+ env: TOXENV=py27
+ - python: 3.4
+ env: TOXENV=py34
+ - python: 3.5
+ env: TOXENV=py35
+ - python: 3.6
+ env: TOXENV=py36
+ - python: 2.7
+ env: TOXENV=pep8
+ - python: 3.5
+ env: TOXENV=py3pep8
+
+install:
+ - pip install --upgrade pip setuptools
+ - pip --version
+ - pip install tox
+ - tox --version
+
+script:
+ - tox
=====================================
MANIFEST.in
=====================================
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,5 @@
include README COPYING
+include tox.ini
+include setup.cfg
+include tests.py tests.krb5.conf
+include .coveragerc
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,23 @@
+python-kdcproxy (0.3.3-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Update upstream urls, add VCS urls.
+ * Bump debhelper to 10.
+ * Remove obsolete patches.
+ * control: Add python-setuptools to build-depends.
+ * rules: Override dh_clean.
+ * control: Bump policy to 4.1.2, no changes.
+
+ -- Timo Aaltonen <tjaalton at debian.org> Sun, 24 Dec 2017 11:51:38 +0200
+
+python-kdcproxy (0.3.2-5) unstable; urgency=medium
+
+ * rules: Disable tests, no way to stop accessing the network it seems.
+ (Closes: #854191)
+ * Add upstream README to packages. (Closes: #843203)
+
+ -- Timo Aaltonen <tjaalton at debian.org> Sun, 05 Feb 2017 08:03:59 +0200
+
python-kdcproxy (0.3.2-4) unstable; urgency=medium
* rules: Set a local http_proxy to avoid accessing network.
=====================================
debian/compat
=====================================
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-9
+10
=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Uploaders: Timo Aaltonen <tjaalton at debian.org>
Section: python
Priority: optional
Build-Depends:
- debhelper (>= 9),
+ debhelper (>= 10),
dh-python,
libkrb5-3,
python-all (>= 2.6.6-3),
@@ -14,6 +14,7 @@ Build-Depends:
python-pyasn1,
python-pytest,
python-pytest-cov,
+ python-setuptools,
python-webtest,
python3-all,
python3-coverage,
@@ -22,12 +23,15 @@ Build-Depends:
python3-pyasn1,
python3-pytest,
python3-pytest-cov,
+ python3-setuptools,
python3-webtest,
tox,
X-Python-Version: >= 2.7
X-Python3-Version: >= 3.3
-Standards-Version: 3.9.6
-Homepage: http://github.com/npmccallum/kdcproxy
+Standards-Version: 4.1.2
+Homepage: http://github.com/latchset/kdcproxy
+Vcs-Git: https://anonscm.debian.org/git/pkg-freeipa/python-kdcproxy.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-freeipa/python-kdcproxy.git
Package: python-kdcproxy
Architecture: all
=====================================
debian/copyright
=====================================
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,6 +1,6 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: kdcproxy
-Source: http://github.com/npmccallum/kdcproxy
+Source: http://github.com/latchset/kdcproxy
Files: *
Copyright: 2013-2015 Red Hat, Inc.
=====================================
debian/patches/fix-coverage.diff deleted
=====================================
--- a/debian/patches/fix-coverage.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/tox.ini b/tox.ini
-index 33b86eb..0438a2f 100644
---- a/tox.ini
-+++ b/tox.ini
-@@ -8,8 +8,8 @@ deps =
- WebTest
- pyasn1
- commands =
-- coverage run -m pytest --capture=no --strict {posargs}
-- coverage report -m
-+ python-coverage run -m pytest --capture=no --strict {posargs}
-+ python-coverage report -m
-
- [testenv:py27]
- deps =
=====================================
debian/patches/series
=====================================
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
-fix-coverage.diff
-workaround-mock-bug.diff
+# placeholder
=====================================
debian/patches/workaround-mock-bug.diff deleted
=====================================
--- a/debian/patches/workaround-mock-bug.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-https://github.com/testing-cabal/mock/issues/323
-
---- a/tests.py
-+++ b/tests.py
-@@ -79,7 +79,7 @@ class KDCProxyWSGITests(unittest.TestCas
- self.assertEqual(r.text, 'Method not allowed (GET).')
-
- @mock.patch('socket.getaddrinfo', return_value=addrinfo)
-- @mock.patch('socket.socket', autospec=True)
-+ @mock.patch('socket.socket')
- def test_post_asreq(self, m_socket, m_getaddrinfo):
- response = self.post(KDCProxyCodecTests.asreq1)
- self.assert_response(response)
-@@ -92,7 +92,7 @@ class KDCProxyWSGITests(unittest.TestCas
- )
-
- @mock.patch('socket.getaddrinfo', return_value=addrinfo)
-- @mock.patch('socket.socket', autospec=True)
-+ @mock.patch('socket.socket')
- def test_post_kpasswd(self, m_socket, m_getaddrinfo):
- response = self.post(KDCProxyCodecTests.kpasswdreq)
- self.assert_response(response)
=====================================
debian/python-kdcproxy.docs
=====================================
--- /dev/null
+++ b/debian/python-kdcproxy.docs
@@ -0,0 +1 @@
+README
=====================================
debian/python3-kdcproxy.docs
=====================================
--- /dev/null
+++ b/debian/python3-kdcproxy.docs
@@ -0,0 +1 @@
+README
=====================================
debian/rules
=====================================
--- a/debian/rules
+++ b/debian/rules
@@ -11,4 +11,7 @@ override_dh_auto_install:
rm -rf debian/python*-kdcproxy/usr/lib/python*/dist-packages/kdcproxy-*.egg-info
override_dh_auto_test:
- http_proxy='http://127.0.0.1:9/' tox --sitepackages -e py27,py35
+
+override_dh_clean:
+ dh_clean
+ rm -rf kdcproxy.egg-info/
=====================================
debian/watch
=====================================
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,2 @@
version=3
-https://github.com/npmccallum/kdcproxy/tags (?:.*/)?v?(\d[\d\.]*)\.tar\.gz
+https://github.com/latchset/kdcproxy/tags (?:.*/)?v?(\d[\d\.]*)\.tar\.gz
=====================================
kdcproxy/__init__.py
=====================================
--- a/kdcproxy/__init__.py
+++ b/kdcproxy/__init__.py
@@ -27,16 +27,16 @@ import struct
import sys
import time
-try: # Python 3.x
+import kdcproxy.codec as codec
+from kdcproxy.config import MetaResolver
+
+if sys.version_info.major >= 3: # Python 3.x
import http.client as httplib
import urllib.parse as urlparse
-except ImportError: # Python 2.x
+else:
import httplib
import urlparse
-import kdcproxy.codec as codec
-from kdcproxy.config import MetaResolver
-
class HTTPException(Exception):
@@ -178,10 +178,13 @@ class Application:
raise HTTPException(405, "Method not allowed (%s)." % method)
# Parse the request
+ length = -1
try:
length = int(env["CONTENT_LENGTH"])
- except AttributeError:
- raise HTTPException(411, "Length required.")
+ except KeyError:
+ pass
+ except ValueError:
+ pass
if length < 0:
raise HTTPException(411, "Length required.")
if length > self.MAX_LENGTH:
@@ -228,8 +231,8 @@ class Application:
for addr in addrs + (None,):
if addr is not None:
# Bypass unspecified socktypes
- if (len(scheme) > 1
- and addr[1] != self.SOCKTYPES[scheme[1]]):
+ if (len(scheme) > 1 and
+ addr[1] != self.SOCKTYPES[scheme[1]]):
continue
# Create the socket
@@ -278,4 +281,5 @@ class Application:
start_response(str(e), e.headers)
return [e.message]
+
application = Application()
=====================================
kdcproxy/config/mit.py
=====================================
--- a/kdcproxy/config/mit.py
+++ b/kdcproxy/config/mit.py
@@ -33,8 +33,10 @@ from kdcproxy.config import IConfig
class KRB5Error(Exception):
pass
+
PY3 = sys.version_info[0] == 3
+
try:
LIBKRB5 = ctypes.CDLL('libkrb5.so.3')
except OSError as e: # pragma: no cover
@@ -272,6 +274,7 @@ class MITConfig(IConfig):
def use_dns(self, default=True):
return self.__config["dns"]
+
if __name__ == "__main__":
from pprint import pprint
with KRB5Profile() as prof:
=====================================
setup.cfg
=====================================
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,8 @@
+[bdist_wheel]
+universal = 1
+
+[aliases]
+# requires setuptools and wheel package
+# dnf install python3-setuptools python3-wheel
+packages = clean --all egg_info bdist_wheel sdist --format=zip sdist --format=gztar
+release = packages register upload
=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -21,11 +21,32 @@
import os
import sys
-from distutils.core import setup
-dns = "dnspython"
-if sys.version_info.major == 3:
- dns += "3"
+import setuptools
+from setuptools import setup
+
+
+SETUPTOOLS_VERSION = tuple(int(v) for v in setuptools.__version__.split("."))
+
+install_requires = [
+ 'pyasn1',
+]
+
+extras_require = {
+ "tests": ["pytest", "coverage", "WebTest"],
+ "test_pep8": ['flake8', 'flake8-import-order', 'pep8-naming']
+}
+
+if SETUPTOOLS_VERSION >= (18, 0):
+ extras_require.update({
+ ":python_version<'3'": ["dnspython"],
+ ":python_version>='3'": ["dnspython3"],
+ })
+else:
+ if sys.version_info.major == 2:
+ install_requires.append("dnspython")
+ else:
+ install_requires.append("dnspython3")
def read(fname):
@@ -33,9 +54,10 @@ def read(fname):
with open(fname) as f:
return f.read()
+
setup(
name="kdcproxy",
- version="0.3.2",
+ version="0.3.3",
author="Nalin Dahyabhai, Nathaniel McCallum, Christian Heimes",
author_email="nalin at redhat.com, npmccallum at redhat.com, cheimes at redhat.com",
description=("A kerberos KDC HTTP proxy WSGI module."),
@@ -44,15 +66,18 @@ setup(
url="http://github.com/npmccallum/kdcproxy",
packages=['kdcproxy', 'kdcproxy.config'],
long_description=read('README'),
- requires=['pyasn1', dns],
+ install_requires=install_requires,
+ extras_require=extras_require,
classifiers=[
- "Development Status :: 3 - Alpha",
+ "Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
"Topic :: Internet :: Proxy Servers",
],
)
=====================================
tests.py
=====================================
--- a/tests.py
+++ b/tests.py
@@ -34,7 +34,7 @@ from dns.rdtypes.IN.SRV import SRV
from pyasn1.codec.der import decoder, encoder
-from webtest import TestApp
+from webtest import TestApp as WebTestApp
import kdcproxy
# from kdcproxy import asn1
@@ -59,7 +59,7 @@ class KDCProxyWSGITests(unittest.TestCase):
self.await_reply.return_value = b'RESPONSE'
self.resolver = self.app._Application__resolver = mock.Mock()
self.resolver.lookup.return_value = ["kerberos://k1.kdcproxy.test.:88"]
- self.tapp = TestApp(self.app)
+ self.tapp = WebTestApp(self.app)
def post(self, body, expect_errors=False):
return self.tapp.post(
@@ -79,7 +79,7 @@ class KDCProxyWSGITests(unittest.TestCase):
self.assertEqual(r.text, 'Method not allowed (GET).')
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
- @mock.patch('socket.socket', autospec=True)
+ @mock.patch('socket.socket')
def test_post_asreq(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.asreq1)
self.assert_response(response)
@@ -92,7 +92,7 @@ class KDCProxyWSGITests(unittest.TestCase):
)
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
- @mock.patch('socket.socket', autospec=True)
+ @mock.patch('socket.socket')
def test_post_kpasswd(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.kpasswdreq)
self.assert_response(response)
=====================================
tox.ini
=====================================
--- a/tox.ini
+++ b/tox.ini
@@ -1,44 +1,33 @@
[tox]
-envlist = py27,py34,pep8,py3pep8,doc
+minversion = 2.3.1
+envlist = py27,py34,py35,py36,pep8,py3pep8,doc
+skip_missing_interpreters = true
[testenv]
deps =
- pytest
- coverage
- WebTest
- pyasn1
+ .[tests]
commands =
- coverage run -m pytest --capture=no --strict {posargs}
- coverage report -m
+ {envpython} -m coverage run -m pytest --capture=no --strict {posargs}
+ {envpython} -m coverage report -m
[testenv:py27]
deps =
- {[testenv]deps}
- dnspython
- mock
-
-[testenv:py34]
-deps =
- {[testenv]deps}
- dnspython3
+ .[tests]
+ mock
[testenv:pep8]
basepython = python2.7
deps =
- flake8
- flake8-import-order
- pep8-naming
+ .[test_pep8]
commands =
- flake8 {posargs}
+ {envpython} -m flake8
[testenv:py3pep8]
-basepython = python3.4
+basepython = python3
deps =
- flake8
- flake8-import-order
- pep8-naming
+ .[test_pep8]
commands =
- flake8 {posargs}
+ {envpython} -m flake8
[testenv:doc]
deps =
View it on GitLab: https://salsa.debian.org/freeipa-team/python-kdcproxy/compare/eee67da8159b0b0f8e099462306d739dffd1a8fb...3712f23a8473808e42f196e026d6cc77e03e327b
--
View it on GitLab: https://salsa.debian.org/freeipa-team/python-kdcproxy/compare/eee67da8159b0b0f8e099462306d739dffd1a8fb...3712f23a8473808e42f196e026d6cc77e03e327b
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-freeipa-devel/attachments/20180804/1a6441fb/attachment-0001.html>
More information about the Pkg-freeipa-devel
mailing list