Transfert the distutil.ext from the org.asm project
This commit is contained in:
@ -10,33 +10,29 @@ from obidistutils.serenity.checksystem import is_mac_system
|
|||||||
|
|
||||||
class build(ori_build):
|
class build(ori_build):
|
||||||
|
|
||||||
def has_ctools(self):
|
|
||||||
return self.distribution.has_ctools()
|
|
||||||
|
|
||||||
def has_files(self):
|
|
||||||
return self.distribution.has_files()
|
|
||||||
|
|
||||||
def has_executables(self):
|
|
||||||
return self.distribution.has_executables()
|
|
||||||
|
|
||||||
def has_ext_modules(self):
|
def has_ext_modules(self):
|
||||||
return self.distribution.has_ext_modules()
|
return self.distribution.has_ext_modules()
|
||||||
|
|
||||||
def has_littlebigman(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def has_pidname(self):
|
def has_pidname(self):
|
||||||
return is_mac_system()
|
return is_mac_system()
|
||||||
|
|
||||||
def has_doc(self):
|
def has_doc(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def has_littlebigman(self):
|
||||||
|
return True
|
||||||
|
|
||||||
sub_commands = [('littlebigman', has_littlebigman),
|
try:
|
||||||
('pidname',has_pidname),
|
from obidistutils.command.build_sphinx import build_sphinx # @UnusedImport
|
||||||
('build_ctools', has_ctools),
|
|
||||||
('build_files', has_files),
|
sub_commands = [("littlebigman",has_littlebigman),
|
||||||
('build_cexe', has_executables)] \
|
('pidname',has_pidname)
|
||||||
+ ori_build.sub_commands + \
|
] \
|
||||||
[('build_sphinx',has_doc)]
|
+ ori_build.sub_commands + \
|
||||||
|
[('build_sphinx',has_doc)]
|
||||||
|
except ImportError:
|
||||||
|
sub_commands = [("littlebigman",has_littlebigman),
|
||||||
|
('pidname',has_pidname)
|
||||||
|
] \
|
||||||
|
+ ori_build.sub_commands
|
||||||
|
|
||||||
|
@ -4,10 +4,11 @@ Created on 20 oct. 2012
|
|||||||
@author: coissac
|
@author: coissac
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from obidistutils.command.build_ctools import build_ctools
|
from .build_ctools import build_ctools
|
||||||
|
from .build_exe import build_exe
|
||||||
from distutils.errors import DistutilsSetupError
|
from distutils.errors import DistutilsSetupError
|
||||||
from distutils import log
|
from distutils import log
|
||||||
|
import os
|
||||||
|
|
||||||
class build_cexe(build_ctools):
|
class build_cexe(build_ctools):
|
||||||
|
|
||||||
@ -38,7 +39,9 @@ class build_cexe(build_ctools):
|
|||||||
self.set_undefined_options('build_files',
|
self.set_undefined_options('build_files',
|
||||||
('files', 'built_files'))
|
('files', 'built_files'))
|
||||||
|
|
||||||
self.executables = self.distribution.executables
|
self.executables = self.distribution.executables
|
||||||
|
# self.build_cexe = os.path.join(os.path.dirname(self.build_cexe),'cbinaries')
|
||||||
|
# self.mkpath(self.build_cexe)
|
||||||
|
|
||||||
if self.executables:
|
if self.executables:
|
||||||
self.check_executable_list(self.executables)
|
self.check_executable_list(self.executables)
|
||||||
@ -71,3 +74,12 @@ class build_cexe(build_ctools):
|
|||||||
|
|
||||||
return sources
|
return sources
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
|
||||||
|
for cmd_name in self.get_sub_commands():
|
||||||
|
self.run_command(cmd_name)
|
||||||
|
|
||||||
|
build_exe.run(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ Created on 20 oct. 2012
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from obidistutils.command.build_exe import build_exe
|
from .build_exe import build_exe
|
||||||
|
from distutils import log
|
||||||
|
|
||||||
class build_ctools(build_exe):
|
class build_ctools(build_exe):
|
||||||
description = "build C/C++ executable not distributed with Python extensions"
|
description = "build C/C++ executable not distributed with Python extensions"
|
||||||
@ -37,19 +38,26 @@ class build_ctools(build_exe):
|
|||||||
self.executables = self.distribution.ctools
|
self.executables = self.distribution.ctools
|
||||||
self.check_executable_list(self.executables)
|
self.check_executable_list(self.executables)
|
||||||
|
|
||||||
|
|
||||||
if self.littlebigman =='-DLITTLE_END':
|
if self.littlebigman =='-DLITTLE_END':
|
||||||
if self.define is None:
|
if self.define is None:
|
||||||
self.define=[('LITTLE_END',None)]
|
self.define=[('LITTLE_END',None)]
|
||||||
else:
|
else:
|
||||||
self.define.append('LITTLE_END',None)
|
self.define.append('LITTLE_END',None)
|
||||||
|
|
||||||
|
log.info('Look for CPU architecture... %s',self.define)
|
||||||
|
|
||||||
self.ctools = set()
|
self.ctools = set()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
for cmd_name in self.get_sub_commands():
|
||||||
|
self.run_command(cmd_name)
|
||||||
|
|
||||||
|
|
||||||
build_exe.run(self)
|
build_exe.run(self)
|
||||||
|
|
||||||
for e,p in self.executables: # @UnusedVariable
|
for e,p in self.executables: # @UnusedVariable
|
||||||
self.ctools.add(e)
|
self.ctools.add(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,3 +208,4 @@ class build_exe(Command):
|
|||||||
output_dir=self.build_cexe,
|
output_dir=self.build_cexe,
|
||||||
debug=self.debug)
|
debug=self.debug)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,11 +9,15 @@ import os
|
|||||||
|
|
||||||
from Cython.Distutils import build_ext as ori_build_ext # @UnresolvedImport
|
from Cython.Distutils import build_ext as ori_build_ext # @UnresolvedImport
|
||||||
|
|
||||||
|
from Cython.Compiler import Options as cython_options # @UnresolvedImport
|
||||||
|
|
||||||
from distutils.errors import DistutilsSetupError
|
from distutils.errors import DistutilsSetupError
|
||||||
|
|
||||||
class build_ext(ori_build_ext):
|
class build_ext(ori_build_ext):
|
||||||
|
|
||||||
|
|
||||||
def modifyDocScripts(self):
|
def modifyDocScripts(self):
|
||||||
build_dir_file=open("doc/build_dir.txt","w")
|
build_dir_file=open("doc/sphinx/build_dir.txt","w")
|
||||||
print(self.build_lib,file=build_dir_file)
|
print(self.build_lib,file=build_dir_file)
|
||||||
build_dir_file.close()
|
build_dir_file.close()
|
||||||
|
|
||||||
@ -84,9 +88,25 @@ class build_ext(ori_build_ext):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.modifyDocScripts()
|
self.modifyDocScripts()
|
||||||
|
|
||||||
|
for cmd_name in self.get_sub_commands():
|
||||||
|
self.run_command(cmd_name)
|
||||||
|
|
||||||
|
cython_options.annotate = True
|
||||||
ori_build_ext.run(self) # @UndefinedVariable
|
ori_build_ext.run(self) # @UndefinedVariable
|
||||||
|
|
||||||
|
|
||||||
|
def has_files(self):
|
||||||
|
return self.distribution.has_files()
|
||||||
|
|
||||||
|
def has_executables(self):
|
||||||
|
return self.distribution.has_executables()
|
||||||
|
|
||||||
|
sub_commands = [('build_files',has_files),
|
||||||
|
('build_cexe', has_executables)
|
||||||
|
] + \
|
||||||
|
ori_build_ext.sub_commands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@ class build_files(Command):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
for cmd_name in self.get_sub_commands():
|
||||||
|
self.run_command(cmd_name)
|
||||||
|
|
||||||
|
|
||||||
for dest,prog,command in self.distribution.files:
|
for dest,prog,command in self.distribution.files:
|
||||||
destfile = os.path.join(self.build_temp,dest)
|
destfile = os.path.join(self.build_temp,dest)
|
||||||
if prog in self.ctools:
|
if prog in self.ctools:
|
||||||
@ -48,6 +52,12 @@ class build_files(Command):
|
|||||||
|
|
||||||
log.info("Done.\n")
|
log.info("Done.\n")
|
||||||
|
|
||||||
|
def has_ctools(self):
|
||||||
|
return self.distribution.has_ctools()
|
||||||
|
|
||||||
|
|
||||||
|
sub_commands = [('build_ctools', has_ctools)] + \
|
||||||
|
Command.sub_commands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@ Created on 20 oct. 2012
|
|||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from distutils.command.build_scripts import build_scripts as ori_build_scripts,\
|
from distutils.command.build_scripts import build_scripts as ori_build_scripts
|
||||||
first_line_re
|
|
||||||
from distutils.util import convert_path
|
from distutils.util import convert_path
|
||||||
from distutils import log, sysconfig
|
from distutils import log, sysconfig
|
||||||
from distutils.dep_util import newer
|
from distutils.dep_util import newer
|
||||||
from stat import ST_MODE
|
from stat import ST_MODE
|
||||||
|
import re
|
||||||
|
|
||||||
|
first_line_re = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
|
||||||
|
|
||||||
class build_scripts(ori_build_scripts):
|
class build_scripts(ori_build_scripts):
|
||||||
|
|
||||||
|
@ -4,23 +4,24 @@ Created on 10 mars 2015
|
|||||||
@author: coissac
|
@author: coissac
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from sphinx.setup_command import BuildDoc as ori_build_sphinx # @UnresolvedImport
|
try:
|
||||||
|
from sphinx.setup_command import BuildDoc as ori_build_sphinx # @UnresolvedImport
|
||||||
|
|
||||||
class build_sphinx(ori_build_sphinx):
|
class build_sphinx(ori_build_sphinx):
|
||||||
'''
|
'''Build Sphinx documentation in html, epub and man formats
|
||||||
Build Sphinx documentation in html, epub and man formats
|
'''
|
||||||
'''
|
|
||||||
|
|
||||||
description = __doc__
|
description = __doc__
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.builder='html'
|
|
||||||
self.finalize_options()
|
|
||||||
ori_build_sphinx.run(self)
|
|
||||||
self.builder='epub'
|
|
||||||
self.finalize_options()
|
|
||||||
ori_build_sphinx.run(self)
|
|
||||||
self.builder='man'
|
|
||||||
self.finalize_options()
|
|
||||||
ori_build_sphinx.run(self)
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.builder='html'
|
||||||
|
self.finalize_options()
|
||||||
|
ori_build_sphinx.run(self)
|
||||||
|
self.builder='epub'
|
||||||
|
self.finalize_options()
|
||||||
|
ori_build_sphinx.run(self)
|
||||||
|
self.builder='man'
|
||||||
|
self.finalize_options()
|
||||||
|
ori_build_sphinx.run(self)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
@ -4,11 +4,16 @@ Created on 6 oct. 2014
|
|||||||
@author: coissac
|
@author: coissac
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.command.install import install as install_ori
|
||||||
|
# except ImportError:
|
||||||
|
# from distutils.command.install import install as install_ori
|
||||||
|
|
||||||
from distutils.command.install import install as install_ori
|
from distutils.command.install import install as install_ori
|
||||||
|
|
||||||
class install(install_ori):
|
class install(install_ori):
|
||||||
|
|
||||||
def __init__(self,dist):
|
def __init__(self,dist):
|
||||||
install_ori.__init__(self, dist)
|
install_ori.__init__(self, dist)
|
||||||
self.sub_commands.insert(0, ('build',lambda self: True))
|
# self.sub_commands.insert(0, ('build',lambda self: True))
|
||||||
self.sub_commands.append(('install_sphinx',lambda self: self.distribution.serenity))
|
self.sub_commands.append(('install_sphinx',lambda self: self.distribution.serenity))
|
||||||
|
@ -3,6 +3,12 @@ Created on 20 oct. 2012
|
|||||||
|
|
||||||
@author: coissac
|
@author: coissac
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.command.install_scripts import install_scripts as ori_install_scripts
|
||||||
|
# except ImportError:
|
||||||
|
# from distutils.command.install_scripts import install_scripts as ori_install_scripts
|
||||||
|
|
||||||
from distutils.command.install_scripts import install_scripts as ori_install_scripts
|
from distutils.command.install_scripts import install_scripts as ori_install_scripts
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
@ -18,12 +24,10 @@ class install_scripts(ori_install_scripts):
|
|||||||
def install_public_link(self):
|
def install_public_link(self):
|
||||||
self.mkpath(self.public_dir)
|
self.mkpath(self.public_dir)
|
||||||
for file in self.get_outputs():
|
for file in self.get_outputs():
|
||||||
if self.dry_run:
|
log.info("exporting file %s -> %s", file,os.path.join(self.public_dir,
|
||||||
log.info("changing mode of %s", file)
|
os.path.split(file)[1]
|
||||||
else:
|
))
|
||||||
log.info("exporting file %s -> %s", file,os.path.join(self.public_dir,
|
if not self.dry_run:
|
||||||
os.path.split(file)[1]
|
|
||||||
))
|
|
||||||
dest = os.path.join(self.public_dir,
|
dest = os.path.join(self.public_dir,
|
||||||
os.path.split(file)[1]
|
os.path.split(file)[1]
|
||||||
)
|
)
|
||||||
|
@ -43,4 +43,19 @@ class install_sphinx(Command):
|
|||||||
self.copy_file(os.path.join(epub),
|
self.copy_file(os.path.join(epub),
|
||||||
os.path.join(self.install_doc,os.path.split(epub)[1]))
|
os.path.join(self.install_doc,os.path.split(epub)[1]))
|
||||||
|
|
||||||
|
def get_outputs(self):
|
||||||
|
directory=os.path.join(self.install_doc,'html')
|
||||||
|
files = [os.path.join(self.install_doc,'html', f)
|
||||||
|
for dp, dn, filenames in os.walk(directory) for f in filenames] # @UnusedVariable
|
||||||
|
|
||||||
|
directory=os.path.join(self.build_dir,'man')
|
||||||
|
files.append(os.path.join(self.install_doc,'man','man1', f)
|
||||||
|
for dp, dn, filenames in os.walk(directory) for f in filenames) # @UnusedVariable
|
||||||
|
|
||||||
|
directory=os.path.join(self.build_dir,'epub')
|
||||||
|
files.append(os.path.join(self.install_doc, f)
|
||||||
|
for dp, dn, filenames in os.walk(directory) # @UnusedVariable
|
||||||
|
for f in glob.glob(os.path.join(dp, '*.epub')) )
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
@ -49,7 +49,7 @@ class littlebigman(build_exe):
|
|||||||
shell=True,
|
shell=True,
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
little = p.communicate()[0]
|
little = p.communicate()[0]
|
||||||
return little
|
return little.decode('latin1')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
build_exe.run(self)
|
build_exe.run(self)
|
||||||
|
@ -41,6 +41,10 @@ class pidname(build_exe):
|
|||||||
else:
|
else:
|
||||||
self.executables = []
|
self.executables = []
|
||||||
|
|
||||||
|
# self.build_cexe = os.path.join(os.path.dirname(self.build_cexe),'cbinaries')
|
||||||
|
# self.mkpath(self.build_cexe)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if is_mac_system():
|
if is_mac_system():
|
||||||
|
@ -9,8 +9,11 @@ import os.path
|
|||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.extension import Extension
|
||||||
|
# except ImportError:
|
||||||
|
# from distutils.extension import Extension
|
||||||
|
|
||||||
from distutils.core import setup as ori_setup
|
|
||||||
from distutils.extension import Extension
|
from distutils.extension import Extension
|
||||||
|
|
||||||
from obidistutils.serenity.checkpackage import install_requirements,\
|
from obidistutils.serenity.checkpackage import install_requirements,\
|
||||||
@ -22,6 +25,7 @@ from obidistutils.serenity.rerun import rerun_with_anothe_python
|
|||||||
from distutils import log
|
from distutils import log
|
||||||
|
|
||||||
from obidistutils.dist import Distribution
|
from obidistutils.dist import Distribution
|
||||||
|
from obidistutils.serenity import is_serenity
|
||||||
|
|
||||||
|
|
||||||
def findPackage(root,base=None):
|
def findPackage(root,base=None):
|
||||||
@ -62,7 +66,10 @@ def findCython(root,base=None,pyrexs=None):
|
|||||||
cfiles = [x for x in cfiles if x[-2:]==".c"]
|
cfiles = [x for x in cfiles if x[-2:]==".c"]
|
||||||
pyrexs[-1].sources.extend(cfiles)
|
pyrexs[-1].sources.extend(cfiles)
|
||||||
pyrexs[-1].include_dirs.extend(incdir)
|
pyrexs[-1].include_dirs.extend(incdir)
|
||||||
pyrexs[-1].extra_compile_args.extend(['-msse2','-Wno-unused-function'])
|
pyrexs[-1].extra_compile_args.extend(['-msse2',
|
||||||
|
'-Wno-unused-function',
|
||||||
|
'-Wmissing-braces',
|
||||||
|
'-Wchar-subscripts'])
|
||||||
|
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
@ -78,8 +85,8 @@ def rootname(x):
|
|||||||
def prepare_commands():
|
def prepare_commands():
|
||||||
from obidistutils.command.build import build
|
from obidistutils.command.build import build
|
||||||
from obidistutils.command.littlebigman import littlebigman
|
from obidistutils.command.littlebigman import littlebigman
|
||||||
|
# from obidistutils.command.serenity import serenity
|
||||||
from obidistutils.command.build_cexe import build_cexe
|
from obidistutils.command.build_cexe import build_cexe
|
||||||
from obidistutils.command.build_sphinx import build_sphinx
|
|
||||||
from obidistutils.command.build_ext import build_ext
|
from obidistutils.command.build_ext import build_ext
|
||||||
from obidistutils.command.build_ctools import build_ctools
|
from obidistutils.command.build_ctools import build_ctools
|
||||||
from obidistutils.command.build_files import build_files
|
from obidistutils.command.build_files import build_files
|
||||||
@ -90,7 +97,10 @@ def prepare_commands():
|
|||||||
from obidistutils.command.pidname import pidname
|
from obidistutils.command.pidname import pidname
|
||||||
from obidistutils.command.sdist import sdist
|
from obidistutils.command.sdist import sdist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
COMMANDS = {'build':build,
|
COMMANDS = {'build':build,
|
||||||
|
# 'serenity':serenity,
|
||||||
'littlebigman':littlebigman,
|
'littlebigman':littlebigman,
|
||||||
'pidname':pidname,
|
'pidname':pidname,
|
||||||
'build_ctools':build_ctools,
|
'build_ctools':build_ctools,
|
||||||
@ -98,12 +108,22 @@ def prepare_commands():
|
|||||||
'build_cexe':build_cexe,
|
'build_cexe':build_cexe,
|
||||||
'build_ext': build_ext,
|
'build_ext': build_ext,
|
||||||
'build_scripts':build_scripts,
|
'build_scripts':build_scripts,
|
||||||
'build_sphinx':build_sphinx,
|
|
||||||
'install_scripts':install_scripts,
|
'install_scripts':install_scripts,
|
||||||
'install_sphinx':install_sphinx,
|
'install_sphinx':install_sphinx,
|
||||||
'install':install,
|
'install':install,
|
||||||
'sdist':sdist}
|
'sdist':sdist}
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.commands import egg_info
|
||||||
|
# COMMANDS['egg_info']=egg_info
|
||||||
|
# except ImportError:
|
||||||
|
# pass
|
||||||
|
try:
|
||||||
|
from obidistutils.command.build_sphinx import build_sphinx
|
||||||
|
COMMANDS['build_sphinx']=build_sphinx
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
return COMMANDS
|
return COMMANDS
|
||||||
|
|
||||||
|
|
||||||
@ -140,18 +160,20 @@ def setup(**attrs):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if is_serenity():
|
||||||
enforce_good_python(minversion, maxversion, fork)
|
|
||||||
|
|
||||||
if (install_requirements(requirementfile)):
|
|
||||||
rerun_with_anothe_python(sys.executable,minversion,maxversion,fork)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
enforce_good_python(minversion, maxversion, fork)
|
||||||
check_requirements(requirementfile)
|
|
||||||
except RequirementError as e :
|
if (install_requirements(requirementfile)):
|
||||||
log.error(e)
|
rerun_with_anothe_python(sys.executable,minversion,maxversion,fork)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
check_requirements(requirementfile)
|
||||||
|
except RequirementError as e :
|
||||||
|
log.error(e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if 'distclass' not in attrs:
|
if 'distclass' not in attrs:
|
||||||
attrs['distclass']=Distribution
|
attrs['distclass']=Distribution
|
||||||
@ -194,4 +216,11 @@ def setup(**attrs):
|
|||||||
if 'ext_modules' not in attrs:
|
if 'ext_modules' not in attrs:
|
||||||
attrs['ext_modules'] = EXTENTION
|
attrs['ext_modules'] = EXTENTION
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.core import setup as ori_setup
|
||||||
|
# except ImportError:
|
||||||
|
# from distutils.core import setup as ori_setup
|
||||||
|
|
||||||
|
from distutils.core import setup as ori_setup
|
||||||
|
|
||||||
ori_setup(**attrs)
|
ori_setup(**attrs)
|
||||||
|
@ -4,6 +4,11 @@ Created on 20 oct. 2012
|
|||||||
@author: coissac
|
@author: coissac
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# from setuptools.dist import Distribution as ori_Distribution
|
||||||
|
# except ImportError:
|
||||||
|
# from distutils.dist import Distribution as ori_Distribution
|
||||||
|
|
||||||
from distutils.dist import Distribution as ori_Distribution
|
from distutils.dist import Distribution as ori_Distribution
|
||||||
|
|
||||||
class Distribution(ori_Distribution):
|
class Distribution(ori_Distribution):
|
||||||
@ -29,6 +34,14 @@ class Distribution(ori_Distribution):
|
|||||||
"By default the name is PACKAGE-VERSION"
|
"By default the name is PACKAGE-VERSION"
|
||||||
))
|
))
|
||||||
|
|
||||||
|
def run_commands(self):
|
||||||
|
"""Run each command that was seen on the setup script command line.
|
||||||
|
Uses the list of commands found and cache of command objects
|
||||||
|
created by 'get_command_obj()'.
|
||||||
|
"""
|
||||||
|
# self.run_command('littlebigman')
|
||||||
|
ori_Distribution.run_commands(self)
|
||||||
|
|
||||||
|
|
||||||
def has_executables(self):
|
def has_executables(self):
|
||||||
return self.executables is not None and self.executables
|
return self.executables is not None and self.executables
|
||||||
|
@ -11,8 +11,7 @@ import re
|
|||||||
from distutils.errors import DistutilsError
|
from distutils.errors import DistutilsError
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import importlib
|
from importlib.util import spec_from_file_location # @UnresolvedImport
|
||||||
import imp
|
|
||||||
import zipimport
|
import zipimport
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@ -106,3 +105,8 @@ def serenity_mode(package,version):
|
|||||||
return args.serenity
|
return args.serenity
|
||||||
|
|
||||||
|
|
||||||
|
def getVersion(source,main,version):
|
||||||
|
path = os.path.join(source,main,'%s.py' % version)
|
||||||
|
spec = spec_from_file_location('version',path)
|
||||||
|
return spec.loader.load_module().version.strip()
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@ def install_requirements(requirementfile='requirements.txt'):
|
|||||||
log.info(" Installing requirement : %s" % x)
|
log.info(" Installing requirement : %s" % x)
|
||||||
pip_install_package(x)
|
pip_install_package(x)
|
||||||
install_something=True
|
install_something=True
|
||||||
|
if x[0:3]=='pip':
|
||||||
|
return True
|
||||||
|
|
||||||
return install_something
|
return install_something
|
||||||
|
|
||||||
@ -134,7 +136,9 @@ def get_package_requirement(package,requirementfile='requirements.txt'):
|
|||||||
|
|
||||||
def pip_install_package(package,directory=None,upgrade=True):
|
def pip_install_package(package,directory=None,upgrade=True):
|
||||||
|
|
||||||
log.info('installing %s in directory %s' % (package,str(directory)))
|
if directory is not None:
|
||||||
|
log.info(' installing %s in directory %s' % (package,str(directory)))
|
||||||
|
|
||||||
|
|
||||||
if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
|
if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
|
||||||
os.environ['https_proxy']=os.environ['http_proxy']
|
os.environ['https_proxy']=os.environ['http_proxy']
|
||||||
@ -144,8 +148,8 @@ def pip_install_package(package,directory=None,upgrade=True):
|
|||||||
if upgrade:
|
if upgrade:
|
||||||
args.append('--upgrade')
|
args.append('--upgrade')
|
||||||
|
|
||||||
if 'http_proxy' in os.environ:
|
if 'https_proxy' in os.environ:
|
||||||
args.append('--proxy=%s' % os.environ['http_proxy'])
|
args.append('--proxy=%s' % os.environ['https_proxy'])
|
||||||
|
|
||||||
if directory is not None:
|
if directory is not None:
|
||||||
args.append('--target=%s' % directory)
|
args.append('--target=%s' % directory)
|
||||||
|
@ -91,9 +91,9 @@ def is_a_virtualenv_python(path=None):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
if path is None:
|
if path is None:
|
||||||
rep = sys.base_exec_prefix == sys.exec_prefix
|
rep = sys.base_exec_prefix != sys.exec_prefix
|
||||||
else:
|
else:
|
||||||
command = """'%s' -c 'import sys; print(sys.base_exec_prefix == sys.exec_prefix)'""" % path
|
command = """'%s' -c 'import sys; print(sys.base_exec_prefix != sys.exec_prefix)'""" % path
|
||||||
p = subprocess.Popen(command,
|
p = subprocess.Popen(command,
|
||||||
shell=True,
|
shell=True,
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
|
@ -9,10 +9,10 @@ import sys
|
|||||||
import venv
|
import venv
|
||||||
|
|
||||||
from distutils.errors import DistutilsError
|
from distutils.errors import DistutilsError
|
||||||
from obidistutils.serenity.globals import local_virtualenv # @UnusedImport
|
from .globals import local_virtualenv # @UnusedImport
|
||||||
from obidistutils.serenity.checkpython import which_virtualenv,\
|
from .checkpython import which_virtualenv,\
|
||||||
is_python_version, \
|
is_python_version, \
|
||||||
is_a_virtualenv_python
|
is_a_virtualenv_python
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ def serenity_virtualenv(envname,package,version,minversion='3.4',maxversion=None
|
|||||||
maxversion=maxversion) and
|
maxversion=maxversion) and
|
||||||
is_a_virtualenv_python(python))
|
is_a_virtualenv_python(python))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The virtualenv already exist but it is not ok
|
# The virtualenv already exist but it is not ok
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user