1 Commits

Author SHA1 Message Date
Frédéric Boyer 50e61b2a7a BUG count obiuniq with merged 2015-03-11 09:07:09 +00:00
505 changed files with 37691 additions and 119278 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OBITools-1.1</name>
<name>OBITools</name>
<comment></comment>
<projects>
</projects>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/obitools/src</path>
<path>/OBITools-1.0/src</path>
<path>/${PROJECT_DIR_NAME}/distutils.ext</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
+1 -2
View File
@@ -1,8 +1,7 @@
include setup.py
recursive-include distutils.ext *.py *.c *.pem
recursive-include distutils.ext *.py *.c
recursive-include src *.pyx *.pxd *.c *.h *.cfiles
recursive-include doc/sphinx/source *.txt *.rst *.py
recursive-include doc/sphinx/sphinxext *.py
include doc/sphinx/make.bat
include doc/sphinx/Makefile
include README.txt
+1 -11
View File
@@ -7,7 +7,6 @@ Created on 20 oct. 2012
from distutils.command.build import build as ori_build
from obidistutils.serenity.checksystem import is_mac_system
from distutils import log
class build(ori_build):
@@ -28,20 +27,11 @@ class build(ori_build):
def has_pidname(self):
return is_mac_system()
def has_doc(self):
return True
sub_commands = [('littlebigman', has_littlebigman),
('pidname',has_pidname),
('build_ctools', has_ctools),
('build_files', has_files),
('build_cexe', has_executables)] \
+ ori_build.sub_commands + \
[('build_sphinx',has_doc)]
def run(self):
log.info('\n\nRunning obidistutils build process\n\n')
ori_build.run(self)
+ ori_build.sub_commands
@@ -4,8 +4,11 @@ Created on 20 oct. 2012
@author: coissac
'''
import os
from obidistutils.command.build_ctools import build_ctools
from distutils.sysconfig import customize_compiler
from distutils.errors import DistutilsSetupError
from distutils import log
class build_cexe(build_ctools):
@@ -4,35 +4,26 @@ Created on 13 fevr. 2014
@author: coissac
'''
from distutils import log
import sys
from obidistutils.serenity import is_serenity
import os
from obidistutils.serenity.checkpackage import install_requirements
from obidistutils.serenity.rerun import rerun_with_anothe_python
try:
from Cython.Distutils import build_ext as ori_build_ext # @UnresolvedImport
except ImportError:
if not is_serenity() and install_requirements():
log.info("Restarting installation with all dependencies ok")
rerun_with_anothe_python(os.path.realpath(sys.executable))
from distutils.command.build_ext import build_ext as ori_build_ext
from distutils.errors import DistutilsSetupError
import os
class build_ext(ori_build_ext):
def modifyDocScripts(self):
print >>open("doc/sphinx/build_dir.txt","w"),self.build_lib
def initialize_options(self):
ori_build_ext.initialize_options(self) # @UndefinedVariable
ori_build_ext.initialize_options(self)
self.littlebigman = None
self.built_files = None
def finalize_options(self):
ori_build_ext.finalize_options(self) # @UndefinedVariable
ori_build_ext.finalize_options(self)
self.set_undefined_options('littlebigman',
('littlebigman', 'littlebigman'))
@@ -92,21 +83,8 @@ class build_ext(ori_build_ext):
def run(self):
self.modifyDocScripts()
ori_build_ext.run(self) # @UndefinedVariable
ori_build_ext.run(self)
# from obidistutils.serenity.getcython import get_a_cython_module
# import imp
# import os.path
#
# log.info("No cython installed, try to install a temporary cython")
# cython = get_a_cython_module()
# sys.path.insert(0,os.path.dirname(os.path.dirname(cython.__file__)))
# f, filename, description=imp.find_module('Distutils',[os.path.dirname(cython.__file__)])
# submodule = imp.load_module('Cython.Distutils', f, filename, description)
# ori_build_ext = submodule.build_ext
#
@@ -1,38 +0,0 @@
'''
Created on 10 mars 2015
@author: coissac
'''
from distutils import log
from obidistutils.serenity.checkpackage import install_requirements
from obidistutils.serenity.rerun import rerun_with_anothe_python
from obidistutils.serenity import is_serenity
import os
import sys
try:
from sphinx.setup_command import BuildDoc as ori_build_sphinx
except ImportError:
if not is_serenity() and install_requirements():
log.info("Restarting installation with all dependencies ok")
rerun_with_anothe_python(os.path.realpath(sys.executable))
class build_sphinx(ori_build_sphinx):
'''
Build Sphinx documentation in html, epub and man formats
'''
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)
+2 -13
View File
@@ -4,22 +4,11 @@ Created on 6 oct. 2014
@author: coissac
'''
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
from distutils import log
from distutils.command.install import install as install_ori
class install(install_ori):
def __init__(self,dist):
install_ori.__init__(self, dist)
self.sub_commands.insert(0, ('build',lambda self: True))
self.sub_commands.append(('install_sphinx',lambda self: self.distribution.serenity))
def run(self):
log.info('\n\nRunning obidistutils install process\n\n')
install_ori.run(self)
@@ -3,13 +3,8 @@ 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
@@ -18,8 +13,7 @@ class install_scripts(ori_install_scripts):
def initialize_options(self):
ori_install_scripts.initialize_options(self)
self.deprecated_scripts = None
self.public_dir = None
def revove_dot_py(self):
for filename in self.get_outputs():
pyfile = "%s.py" % filename
@@ -34,23 +28,8 @@ class install_scripts(ori_install_scripts):
except:
log.info('Unix command %s is not present in build dir' % command)
def install_public_link(self):
self.mkpath(self.public_dir)
for file in self.get_outputs():
if self.dry_run:
log.info("changing mode of %s", file)
else:
log.info("exporting file %s -> %s", file,os.path.join(self.public_dir,
os.path.split(file)[1]
))
dest = os.path.join(self.public_dir,
os.path.split(file)[1]
)
if os.path.exists(dest):
os.unlink(dest)
os.symlink(file,dest)
def remove_deprecated_script(self):
def remove_deprecated_script(self):
if self.deprecated_scripts is not None:
for f in self.deprecated_scripts:
try:
@@ -67,13 +46,8 @@ class install_scripts(ori_install_scripts):
def run(self):
self.remove_deprecated_script()
ori_install_scripts.run(self)
if self.distribution.serenity:
self.public_dir=os.path.join(self.install_dir,"../export/bin")
self.public_dir=os.path.abspath(self.public_dir)
self.install_public_link()
self.revove_dot_py()
@@ -1,46 +0,0 @@
'''
Created on 10 mars 2015
@author: coissac
'''
from distutils.core import Command
import os.path
import glob
class install_sphinx(Command):
'''
Install the sphinx documentation
'''
description = "Install the sphinx documentation in serenity mode"
boolean_options = ['force', 'skip-build']
def initialize_options (self):
self.install_doc = None
self.build_dir = None
def finalize_options (self):
self.set_undefined_options('build_sphinx', ('build_dir', 'build_dir'))
self.set_undefined_options('install',
('install_scripts', 'install_doc'))
def run (self):
if self.distribution.serenity:
self.install_doc = os.path.join(self.install_doc,"../export/share")
self.install_doc=os.path.abspath(self.install_doc)
self.mkpath(self.install_doc)
self.mkpath(os.path.join(self.install_doc,'html'))
outfiles = self.copy_tree(os.path.join(self.build_dir,'html'),
os.path.join(self.install_doc,'html'))
self.mkpath(os.path.join(self.install_doc,'man','man1'))
outfiles = self.copy_tree(os.path.join(self.build_dir,'man'),
os.path.join(self.install_doc,'man','man1'))
for epub in glob.glob(os.path.join(self.build_dir,'epub/*.epub')):
self.copy_file(os.path.join(epub),
os.path.join(self.install_doc,os.path.split(epub)[1]))
@@ -8,7 +8,7 @@ import os
from obidistutils.command.build_exe import build_exe
from obidistutils.serenity.checksystem import is_mac_system
from distutils import log
class pidname(build_exe):
@@ -44,9 +44,7 @@ class pidname(build_exe):
def run(self):
if is_mac_system():
log.info("Building pidname...")
build_exe.run(self)
log.info("Done")
self.pidname=True
else:
self.pidname=False
@@ -1,46 +0,0 @@
'''
Created on 10 mars 2015
@author: coissac
'''
import os.path
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):
def make_distribution(self):
"""Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
'self.keep_temp' is true). The list of archive files created is
stored so it can be retrieved later by 'get_archive_files()'.
"""
# Don't warn about missing meta-data here -- should be (and is!)
# done elsewhere.
base_dir = self.distribution.get_fullname()
base_name = os.path.join(self.dist_dir,base_dir)
self.make_release_tree(os.path.join('tmp',base_dir), self.filelist.files)
archive_files = [] # remember names of files we create
# tar archive must be created last to avoid overwrite and remove
if 'tar' in self.formats:
self.formats.append(self.formats.pop(self.formats.index('tar')))
for fmt in self.formats:
file = self.make_archive(base_name, fmt, root_dir='tmp',base_dir=base_dir,
owner=self.owner, group=self.group)
archive_files.append(file)
self.distribution.dist_files.append(('sdist', '', file))
self.archive_files = archive_files
if not self.keep_temp:
dir_util.remove_tree(os.path.join('tmp',base_dir), dry_run=self.dry_run)
+4 -20
View File
@@ -8,12 +8,10 @@ from os import path
import os.path
import glob
import sys
from obidistutils.command.sdist import sdist
try:
from setuptools import setup as ori_setup
from setuptools.command.egg_info import egg_info
has_setuptools = True
except ImportError:
from distutils.core import setup as ori_setup
@@ -21,16 +19,15 @@ except ImportError:
from distutils.extension import Extension
from obidistutils.command.build import build
from obidistutils.command.littlebigman import littlebigman
from obidistutils.command.build_cexe import build_cexe
from obidistutils.command.build_sphinx import build_sphinx
from obidistutils.command import build_ext
from obidistutils.command.build_ctools import build_ctools
from obidistutils.command.build_files import build_files
from obidistutils.command.build_scripts import build_scripts
from obidistutils.command.install_scripts import install_scripts
from obidistutils.command.install_sphinx import install_sphinx
from obidistutils.command.install import install
from obidistutils.command.pidname import pidname
@@ -125,15 +122,8 @@ COMMANDS = {'build':build,
'build_cexe':build_cexe,
'build_ext': build_ext,
'build_scripts':build_scripts,
'build_sphinx':build_sphinx,
'install_scripts':install_scripts,
'install_sphinx':install_sphinx,
'install':install,
'sdist':sdist}
if has_setuptools:
COMMANDS['egg_info']=egg_info
'install':install}
CTOOLS =[]
CEXES =[]
@@ -143,11 +133,11 @@ 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:
@@ -155,7 +145,6 @@ def setup(**attrs):
except IOError:
pass
if 'distclass' not in attrs:
attrs['distclass']=Distribution
@@ -188,9 +177,6 @@ def setup(**attrs):
if 'sse' not in attrs:
attrs['sse']=None
if 'serenity' not in attrs:
attrs['serenity']=False
EXTENTION=findCython(SRC)
@@ -201,7 +187,5 @@ def setup(**attrs):
if 'ext_modules' not in attrs:
attrs['ext_modules'] = EXTENTION
print "$$$$$$$$$$$$$$$$$$$$$$$$$$$",COMMANDS
ori_setup(**attrs)
+2 -6
View File
@@ -4,10 +4,8 @@ Created on 20 oct. 2012
@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
class Distribution(ori_Distribution):
@@ -19,7 +17,6 @@ class Distribution(ori_Distribution):
self.deprecated_scripts = None
self.zip_safe=False
self.sse = None
self.serenity=attrs['serenity']
ori_Distribution.__init__(self, attrs)
@@ -32,7 +29,6 @@ class Distribution(ori_Distribution):
"By default the name is PACKAGE-VERSION"
))
def has_executables(self):
return self.executables is not None and self.executables
@@ -42,7 +42,7 @@ from obidistutils.serenity.util import save_argv
from obidistutils.serenity.snake import snake
from obidistutils.serenity.globals import PIP_MINVERSION, local_serenity
from obidistutils.serenity.globals import PIP_MINVERSION
def serenity_snake(envname,package,version,minversion=PIP_MINVERSION):
@@ -63,9 +63,7 @@ def serenity_snake(envname,package,version,minversion=PIP_MINVERSION):
log.info("%s will be installed with python : %s" % (package,virtualpython))
if install_requirements():
log.info("Restarting installation with all dependencies ok")
rerun_with_anothe_python(virtualpython)
install_requirements()
log.set_threshold(old)
@@ -73,9 +71,6 @@ def serenity_assert(version,minversion=PIP_MINVERSION):
check_requirements()
def is_serenity():
from obidistutils.serenity.globals import local_serenity
return local_serenity and local_serenity[0]
def serenity_mode(package,version):
@@ -105,13 +100,12 @@ def serenity_mode(package,version):
sys.argv = [sys.argv[0]] + unknown
if args.serenity:
local_serenity.append(True)
serenity_snake(args.virtual,package,version)
else:
local_serenity.append(False)
pass
# serenity_assert(package,version)
log.set_threshold(old)
return args.serenity
@@ -80,7 +80,7 @@ def install_requirements(skip_virtualenv=True,pip=None):
if pip is None:
pip = get_a_pip_module()
install_something=False
try:
requirements = open('requirements.txt').readlines()
requirements = [x.strip() for x in requirements]
@@ -93,12 +93,9 @@ def install_requirements(skip_virtualenv=True,pip=None):
if not ok:
log.info(" Installing requirement : %s" % x)
pip_install_package(x,pip=pip)
install_something=True
except IOError:
pass
return install_something
def check_requirements(skip_virtualenv=True,pip=None):
@@ -56,13 +56,41 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
tmpdir = get_serenity_dir()
if not local_pip:
# if not is_pip_installed(minversion):
# try:
# if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
# os.environ['https_proxy']=os.environ['http_proxy']
# pipinstallscript = urllib2.urlopen('https://bootstrap.pypa.io/get-pip.py')
# except:
# raise DistutilsError,"Pip (>=%s) is not install on your system and I cannot install it" % PIP_MINVERSION
#
# script = pipinstallscript.read()
# getpip_py = os.path.join(tmpdir, "get-pip.py")
# with open(getpip_py, "wb") as fp:
# log.info("Downloading temporary pip...")
# fp.write(script)
# log.info(" done.")
#
# getpip = imp.load_source("getpip",getpip_py)
# ZIPFILE=getpip.ZIPFILE
#
# pip_zip = os.path.join(tmpdir, "pip.zip")
# with open(pip_zip, "wb") as fp:
# log.info("Installing temporary pip...")
# fp.write(base64.decodestring(ZIPFILE))
# log.info(" done.")
#
# # Add the zipfile to sys.path so that we can import it
# sys.path.insert(0,pip_zip)
# zi = zipimport.zipimporter(pip_zip)
# pip = zi.load_module("pip")
# pip = importlib.import_module('obidistutils.serenity.pip')
# else:
serenity = importlib.import_module('obidistutils.serenity')
sys.path.insert(0, os.path.dirname(serenity.__file__))
pip = importlib.import_module('pip')
local_pip.append(pip)
else:
pip = local_pip[-1]
# Prepare the CERT certificat for https download
@@ -5,12 +5,10 @@ Created on 2 oct. 2014
'''
from distutils import util
from distutils import log
def is_mac_system():
platform = util.get_platform().split('-')[0]
if platform=='macosx':
log.info('You are running on a Mac platform')
return platform=='macosx'
def is_windows_system():
@@ -1,72 +0,0 @@
'''
Created on 2 oct. 2014
@author: coissac
'''
import imp
import importlib
from distutils.errors import DistutilsError
from distutils.version import StrictVersion
from distutils import log
from obidistutils.serenity.globals import local_cython # @UnusedImport
from obidistutils.serenity.checkpip import get_a_pip_module
from obidistutils.serenity.checkpackage import get_package_requirement
from obidistutils.serenity.checkpackage import parse_package_requirement
from obidistutils.serenity.checkpackage import is_installed
from obidistutils.serenity.checkpackage import pip_install_package
from obidistutils.serenity.util import get_serenity_dir
def get_a_cython_module(pip=None):
global local_cython
if not local_cython:
if pip is None:
pip = get_a_pip_module()
cython_req = get_package_requirement('Cython',pip)
if cython_req is None:
cython_req='Cython'
requirement_project,requirement_relation,minversion = parse_package_requirement(cython_req) # @UnusedVariable
if cython_req is None or not is_installed(cython_req, pip):
tmpdir = get_serenity_dir()
ok = pip_install_package(cython_req,directory=tmpdir,pip=pip)
log.debug('temp install dir : %s' % tmpdir)
if ok!=0:
raise DistutilsError, "I cannot install a cython package"
f, filename, description = imp.find_module('Cython', [tmpdir])
cythonmodule = imp.load_module('Cython', f, filename, description)
if minversion is not None:
assert StrictVersion(cythonmodule.__version__) >= minversion, \
"Unable to find suitable version of cython get %s instead of %s" % (cythonmodule.__version__,
minversion)
else:
cythonmodule = importlib.import_module('Cython')
local_cython.append(cythonmodule)
return local_cython[0]
@@ -11,5 +11,3 @@ saved_args=[]
tmpdir=[]
local_pip=[]
local_virtualenv=[]
local_cython=[]
local_serenity=[]
Binary file not shown.
@@ -106,7 +106,7 @@ def create_main_parser():
parser = ConfigOptionParser(**parser_kw)
parser.disable_interspersed_args()
pip_pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
parser.version = 'pip %s from %s (python %s)' % (
__version__, pip_pkg_dir, sys.version[:3])
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More