Skip to content

Commit

Permalink
Drop distutils workaround and simplify setup.py
Browse files Browse the repository at this point in the history
Modern Python installations contain setuptools. It is reasonable to
expect it to exist. Simplifies setup.py and removes the large comment
explaining the workaround.

https://github.com/python-ldap/python-ldap/pull/123
  • Loading branch information
Jon Dufresne authored and Petr Viktorin committed Dec 13, 2017
1 parent e80cc61 commit f94619f
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
"""

import sys,os

has_setuptools = False
try:
from setuptools import setup, Extension
has_setuptools = True
except ImportError:
from distutils.core import setup, Extension
from setuptools import setup, Extension

if sys.version_info[0] == 2 and sys.version_info[1] < 7:
raise RuntimeError('This software requires Python 2.7 or 3.x.')
Expand Down Expand Up @@ -66,24 +60,6 @@ class OpenLDAP2:
#-- Let distutils/setuptools do the rest
name = 'python-ldap'

# Python 2.3.6+ and setuptools are needed to build eggs, so
# let's handle setuptools' additional keyword arguments to
# setup() in a fashion that doesn't break compatibility to
# distutils. This still allows 'normal' builds where either
# Python > 2.3.5 or setuptools (or both ;o) are not available.
kwargs = {}
if has_setuptools:
kwargs = {
'include_package_data': True,
'install_requires': [
'setuptools',
'pyasn1 >= 0.3.7',
'pyasn1_modules >= 0.1.5',
],
'zip_safe': False,
'python_requires': '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*',
}

setup(
#-- Package description
name = name,
Expand Down Expand Up @@ -186,6 +162,12 @@ class OpenLDAP2:
],
package_dir = {'': 'Lib',},
data_files = LDAP_CLASS.extra_files,
include_package_data=True,
install_requires=[
'pyasn1 >= 0.3.7',
'pyasn1_modules >= 0.1.5',
],
zip_safe=False,
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*',
test_suite = 'Tests',
**kwargs
)

0 comments on commit f94619f

Please sign in to comment.