diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..542377d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: python + +python: +- '2.7' +- '3.3' +- '3.4' +- '3.5' +- '3.6' +# Note: when updating Python versions, also change setup.py and tox.ini + +sudo: false + +cache: pip + +addons: + apt: + packages: + - ldap-utils + - slapd + +install: + - pip install "pip>=7.1.0" + - pip install tox-travis tox + +script: tox diff --git a/setup.py b/setup.py index a475a35..af6443b 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,8 @@ See https://www.python-ldap.org/ for details. """ +import sys,os + has_setuptools = False try: from setuptools import setup, Extension @@ -11,8 +13,15 @@ except ImportError: from distutils.core import setup, Extension -from ConfigParser import ConfigParser -import sys,os,time +if sys.version_info[0] == 2 and sys.version_info[1] < 7: + raise RuntimeError('This software requires Python 2.7 or 3.x.') +if sys.version_info[0] >= 3 and sys.version_info < (3, 3): + raise RuntimeError('The C API from Python 3.3+ is required.') + +if sys.version_info[0] >= 3: + from configparser import ConfigParser +else: + from ConfigParser import ConfigParser sys.path.insert(0, os.path.join(os.getcwd(), 'Lib/ldap')) import pkginfo @@ -59,7 +68,8 @@ class OpenLDAP2: kwargs = dict( include_package_data = True, install_requires = ['setuptools'], - zip_safe = False + zip_safe = False, + python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*', ) setup( @@ -88,8 +98,17 @@ class OpenLDAP2: 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Programming Language :: C', + 'Programming Language :: Python', 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + # Note: when updating Python versions, also change .travis.yml and tox.ini + 'Topic :: Database', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tox.ini b/tox.ini index d11ce1c..61a6aed 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,8 @@ # and then run "tox" from this directory. [tox] -envlist = py27 +# Note: when updating Python versions, also change setup.py and .travis.yml +envlist = py27,py33,py34,py35,py36 [testenv] commands = {envpython} setup.py test