Commit 3a824692 by Eric Coissac

Use setuptools instead of distutils as much as possible

parent edfa796c
......@@ -4,7 +4,12 @@ Created on 6 oct. 2014
@author: coissac
'''
from distutils.command.install import install as install_ori
try:
from setuptools.command.install import install as install_ori
has_setuptools=True
except ImportError:
from distutils.command.install import install as install_ori
has_setuptools=False
class install(install_ori):
......
......@@ -3,8 +3,13 @@ Created on 20 oct. 2012
@author: coissac
'''
try:
from setuptools.command.install_scripts import install_scripts as ori_install_scripts
has_setuptools = True
except ImportError:
from distutils.command.install_scripts import install_scripts as ori_install_scripts
has_setuptools = False
from distutils.command.install_scripts import install_scripts as ori_install_scripts
import os.path
from distutils import log
......
......@@ -6,7 +6,11 @@ Created on 10 mars 2015
import os.path
from distutils.command.sdist import sdist as orig_sdist
try:
from setuptools.command.sdist import sdist as orig_sdist
except ImportError:
from distutils.command.sdist import sdist as orig_sdist
from distutils import dir_util
class sdist(orig_sdist):
......
......@@ -11,12 +11,12 @@ import sys
from obidistutils.command.sdist import sdist
# try:
# from setuptools import setup as ori_setup
# has_setuptools = True
# except ImportError:
from distutils.core import setup as ori_setup
#has_setuptools = False
try:
from setuptools import setup as ori_setup
has_setuptools = True
except ImportError:
from distutils.core import setup as ori_setup
has_setuptools = False
from distutils.extension import Extension
......@@ -136,32 +136,20 @@ FILES =[]
def setup(**attrs):
# if has_setuptools:
# try:
#
# requirements = open('requirements.txt').readlines()
# requirements = [x.strip() for x in requirements]
# requirements = [x for x in requirements if x[0]!='-']
#
# if 'install_requires' not in attrs:
# attrs['install_requires']=requirements
# else:
# attrs['install_requires'].extend(requirements)
# except IOError:
# pass
try:
requirements = open('requirements.txt').readlines()
requirements = [x.strip() for x in requirements]
requirements = [x for x in requirements if x[0]!='-']
if 'install_requires' not in attrs:
attrs['install_requires']=requirements
else:
attrs['install_requires'].extend(requirements)
except IOError:
pass
if has_setuptools:
try:
requirements = open('requirements.txt').readlines()
requirements = [x.strip() for x in requirements]
requirements = [x for x in requirements if x[0]!='-']
if 'install_requires' not in attrs:
attrs['install_requires']=requirements
else:
attrs['install_requires'].extend(requirements)
except IOError:
pass
if 'distclass' not in attrs:
attrs['distclass']=Distribution
......
......@@ -4,8 +4,10 @@ Created on 20 oct. 2012
@author: coissac
'''
from distutils.dist import Distribution as ori_Distribution
try:
from setuptools.dist import Distribution as ori_Distribution
except ImportError:
from distutils.dist import Distribution as ori_Distribution
class Distribution(ori_Distribution):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment