Commit da7c0a0e by Eric Coissac

First version of get-orgasm.py working correctly

parent d73af4c3
......@@ -9,3 +9,4 @@ include doc/sphinx/make.bat
include doc/sphinx/Makefile
include README.txt
include requirements.txt
include VERSION
0.1.0a1
\ No newline at end of file
......@@ -10,33 +10,29 @@ from obidistutils.serenity.checksystem import is_mac_system
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):
return self.distribution.has_ext_modules()
def has_littlebigman(self):
return True
def has_pidname(self):
return is_mac_system()
def has_doc(self):
return True
def has_littlebigman(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)]
try:
from obidistutils.command.build_sphinx import build_sphinx # @UnusedImport
sub_commands = [("littlebigman",has_littlebigman),
('pidname',has_pidname)
] \
+ 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
'''
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 import log
import os
class build_cexe(build_ctools):
......@@ -38,7 +39,9 @@ class build_cexe(build_ctools):
self.set_undefined_options('build_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:
self.check_executable_list(self.executables)
......@@ -70,4 +73,13 @@ class build_cexe(build_ctools):
log.info("%s ok",message)
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,7 @@ 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):
......@@ -38,7 +38,7 @@ class build_ctools(build_exe):
self.executables = self.distribution.ctools
self.check_executable_list(self.executables)
if self.littlebigman =='-DLITTLE_END':
if self.define is None:
self.define=[('LITTLE_END',None)]
......@@ -50,10 +50,14 @@ class build_ctools(build_exe):
self.ctools = set()
def run(self):
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
build_exe.run(self)
for e,p in self.executables: # @UnusedVariable
self.ctools.add(e)
......@@ -208,3 +208,4 @@ class build_exe(Command):
output_dir=self.build_cexe,
debug=self.debug)
......@@ -14,6 +14,8 @@ from Cython.Compiler import Options as cython_options # @UnresolvedImport
from distutils.errors import DistutilsSetupError
class build_ext(ori_build_ext):
def modifyDocScripts(self):
build_dir_file=open("doc/sphinx/build_dir.txt","w")
print(self.build_lib,file=build_dir_file)
......@@ -86,10 +88,25 @@ class build_ext(ori_build_ext):
def run(self):
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
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
......@@ -28,6 +28,10 @@ class build_files(Command):
self.files = {}
def run(self):
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
for dest,prog,command in self.distribution.files:
destfile = os.path.join(self.build_temp,dest)
......@@ -48,6 +52,12 @@ class build_files(Command):
log.info("Done.\n")
def has_ctools(self):
return self.distribution.has_ctools()
sub_commands = [('build_ctools', has_ctools)] + \
Command.sub_commands
......@@ -4,23 +4,24 @@ Created on 10 mars 2015
@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):
'''Build Sphinx documentation in html, epub and man formats
'''
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)
\ No newline at end of file
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)
except ImportError:
pass
\ No newline at end of file
......@@ -3,8 +3,13 @@ Created on 6 oct. 2014
@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 setuptools.command.install import install as install_ori
class install(install_ori):
......
......@@ -3,6 +3,12 @@ Created on 20 oct. 2012
@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
import os.path
......@@ -18,12 +24,10 @@ class install_scripts(ori_install_scripts):
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]
))
log.info("exporting file %s -> %s", file,os.path.join(self.public_dir,
os.path.split(file)[1]
))
if not self.dry_run:
dest = os.path.join(self.public_dir,
os.path.split(file)[1]
)
......
......@@ -41,6 +41,10 @@ class pidname(build_exe):
else:
self.executables = []
# self.build_cexe = os.path.join(os.path.dirname(self.build_cexe),'cbinaries')
# self.mkpath(self.build_cexe)
def run(self):
if is_mac_system():
......
......@@ -9,8 +9,11 @@ import os.path
import glob
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 obidistutils.serenity.checkpackage import install_requirements,\
......@@ -22,6 +25,7 @@ from obidistutils.serenity.rerun import rerun_with_anothe_python
from distutils import log
from obidistutils.dist import Distribution
from obidistutils.serenity import is_serenity
def findPackage(root,base=None):
......@@ -81,8 +85,8 @@ def rootname(x):
def prepare_commands():
from obidistutils.command.build import build
from obidistutils.command.littlebigman import littlebigman
# from obidistutils.command.serenity import serenity
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_ctools import build_ctools
from obidistutils.command.build_files import build_files
......@@ -92,8 +96,11 @@ def prepare_commands():
from obidistutils.command.install import install
from obidistutils.command.pidname import pidname
from obidistutils.command.sdist import sdist
COMMANDS = {'build':build,
# 'serenity':serenity,
'littlebigman':littlebigman,
'pidname':pidname,
'build_ctools':build_ctools,
......@@ -101,12 +108,22 @@ def prepare_commands():
'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}
# 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
......@@ -142,19 +159,21 @@ def setup(**attrs):
del attrs['requirements']
except KeyError:
pass
enforce_good_python(minversion, maxversion, fork)
if is_serenity():
if (install_requirements(requirementfile)):
rerun_with_anothe_python(sys.executable,minversion,maxversion,fork)
enforce_good_python(minversion, maxversion, fork)
if (install_requirements(requirementfile)):
rerun_with_anothe_python(sys.executable,minversion,maxversion,fork)
try:
check_requirements(requirementfile)
except RequirementError as e :
log.error(e)
sys.exit(1)
try:
check_requirements(requirementfile)
except RequirementError as e :
log.error(e)
sys.exit(1)
if 'distclass' not in attrs:
attrs['distclass']=Distribution
......@@ -196,5 +215,12 @@ def setup(**attrs):
if 'ext_modules' not in attrs:
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)
......@@ -4,10 +4,12 @@ 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
# 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):
......@@ -37,7 +39,7 @@ class Distribution(ori_Distribution):
Uses the list of commands found and cache of command objects
created by 'get_command_obj()'.
"""
self.run_command('littlebigman')
# self.run_command('littlebigman')
ori_Distribution.run_commands(self)
......
#!/usr/bin/env python2
from fileinput import filename
from platform import system
SOFT = "Org.Asm"
SOFT = "ORG.asm"
LIB = "orgasm"
PIP_MINVERSION = '1.5'
MODE = "pypi" # or "svn"
......@@ -37331,7 +37332,7 @@ def cleanModules():
def pip_download_package(package):
tmpdir = getTmpDir()
args = ['install']
args = ['pip install']
if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
os.environ['https_proxy']=os.environ['http_proxy']
......@@ -37340,13 +37341,21 @@ def pip_download_package(package):
args.append('--proxy=%s' % os.environ['http_proxy'])
args.append('--download=%s' % tmpdir)
args.append('--index-url=https://pypi.python.org/simple/')
# args.append('--index-url=https://pypi.python.org/simple/')
args.append('--no-deps')
args.append('-I')
args.append('--pre')
args.append('--no-cache-dir')
args.append(package)
#print(args)
os.system(" ".join(args))
pip.main(args)
#pip.main(args)
#print("####>>>>>> DONE")
filename = glob.glob(os.path.join(tmpdir,"%s*" % package))[0]
tar = tarfile.open(filename)
......@@ -37389,6 +37398,7 @@ def main():
elif MODE=='pypi':
filename = pypidownload()
sys.path.insert(0, filename)
import setup # @UnresolvedImport
......@@ -37396,6 +37406,7 @@ def main():
current = os.getcwd()
virtualenvname = "%s/%s-%s" % (current,setup.PACKAGE,setup.VERSION)
# virtualenvname = "%s/%s-%s" % (current,setup.PACKAGE,'0.0.0a9')
os.chdir(filename)
command = "%s setup.py --serenity --virtualenv='%s' install" % (sys.executable,
......@@ -37412,6 +37423,40 @@ def main():
st = os.stat(activate)
os.chmod(activate, st.st_mode | stat.S_IEXEC)
st = os.stat(activate)
os.chmod(activate, st.st_mode | stat.S_IEXEC)
envactivate = open(os.path.join(virtualenvname,'bin','activate')).readlines()
print(envactivate)
line=0
try:
while True:
if envactivate[line]=='PATH="$VIRTUAL_ENV/bin:$PATH"\n':
envactivate[line]='PATH="$VIRTUAL_ENV/export/bin:$PATH"\n'
envactivate.insert(line+2,'export MANPATH="$VIRTUAL_ENV/export/share/man:$MANPATH"\n')
line+=1
except IndexError:
pass
print("".join(envactivate),
file=open(os.path.join(virtualenvname,'bin','activate'),"w"))
envactivate = open(os.path.join(virtualenvname,'bin','activate.csh')).readlines()
line=0
try:
while True:
if envactivate[line]=='setenv PATH "$VIRTUAL_ENV/bin:$PATH"\n':
envactivate[line]='setenv PATH "$VIRTUAL_ENV/export/bin:$PATH"\n'
envactivate.insert(line+1,'setenv MANPATH "$VIRTUAL_ENV/export/share/man:$MANPATH"\n')
line+=1
except IndexError:
pass
print("".join(envactivate),
file=open(os.path.join(virtualenvname,'bin','activate.csh'),"w"))
shutil.rmtree(os.path.join(virtualenvname,'src'), ignore_errors=True)
shutil.copytree(filename, os.path.join(virtualenvname,'src'), symlinks=True)
major = 0
minor = '0a7'
serial= 'alpha'
minor = '1'
serial= '0a0'
version = "%2d.%s" % (major,minor)
version = "%2d.%s.%s" % (major,minor,serial)
--extra-index-url https://pypi.python.org/simple/
pip>=7.1
Cython>=0.22
Sphinx>=1.3.1
Cython>=0.23
Sphinx>=1.3
#!/usr/bin/env python
import sys
import os
PACKAGE = "ORG.asm"
AUTHOR = 'Eric Coissac'
......@@ -12,7 +13,7 @@ DESCRIPTION ="A de novo assembler dedicated to organelle genome assembling",
SRC = 'python'
CSRC = 'src'
classifiers=['Development Status :: 1 - Planning',
classifiers=['Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Other/Proprietary License',
......@@ -26,16 +27,19 @@ classifiers=['Development Status :: 1 - Planning',
PYTHONMIN='3.4'
directory = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(directory,'distutils.ext'))
sys.path.append(os.path.join(directory,SRC))
print(sys.path)
VERSION=open(os.path.join(directory,'VERSION')).read().strip()
sys.path.append('distutils.ext')
sys.path.append(SRC)
if __name__=="__main__":
from obidistutils.serenity import serenity_mode
from obidistutils.serenity import getVersion
VERSION=getVersion(SRC,'orgasm','version')
serenity=serenity_mode(PACKAGE,VERSION)
......
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