Skip to content

Commit

Permalink
Infra: Advertise and test Python 3 compatibility
Browse files Browse the repository at this point in the history
- Add 3.3 - 3.6 to tox.ini
- Add .travis.yml for Travis CI
- Add 3.3 - 3.6 to Trove classifiers
- Add Python version checking to setup.py
  • Loading branch information
pyldap contributors authored and Petr Viktorin committed Nov 24, 2017
1 parent ebcdaae commit eb06c59
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 22 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
See https://www.python-ldap.org/ for details.
"""

import sys,os

has_setuptools = False
try:
from setuptools import setup, Extension
has_setuptools = True
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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb06c59

Please sign in to comment.