Skip to content

Commit

Permalink
Port setup.py and tox to setuptools
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tiran authored and Nathaniel McCallum committed Jan 4, 2017
1 parent 5ed2ab9 commit 84a8329
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__
/dist
/build
/MANIFEST
/*.egg-info
/.cache
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include README COPYING
include tox.ini
include setup.cfg
include tests.py tests.krb5.conf
include .coveragerc
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
33 changes: 28 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,40 @@

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):
fname = os.path.join(os.path.dirname(__file__), fname)
with open(fname) as f:
return f.read()


setup(
name="kdcproxy",
version="0.3.2",
Expand All @@ -44,7 +66,8 @@ def read(fname):
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",
"Environment :: Web Environment",
Expand Down
37 changes: 13 additions & 24 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down

0 comments on commit 84a8329

Please sign in to comment.