Commit 02d33a54 by Eric Coissac

Patch few bug related to the new version of cython + intallation

problems
parent bb49bc25
......@@ -3,8 +3,8 @@ Created on 6 oct. 2014
@author: coissac
'''
from distutils.command.install import install as install_ori
#from setuptools.command.install import install as install_ori
class install(install_ori):
......
......@@ -108,6 +108,5 @@ def serenity_mode(package,version):
def getVersion(source,main,version):
path = os.path.join(source,main,'%s.py' % version)
spec = spec_from_file_location('version',path)
print(spec.loader)
return spec.loader.load_module().version.strip()
......@@ -83,6 +83,8 @@ def install_requirements(requirementfile='requirements.txt'):
log.info(" Installing requirement : %s" % x)
pip_install_package(x)
install_something=True
if x[0:3]=='pip':
return True
return install_something
......@@ -134,7 +136,9 @@ def get_package_requirement(package,requirementfile='requirements.txt'):
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:
os.environ['https_proxy']=os.environ['http_proxy']
......@@ -144,8 +148,8 @@ def pip_install_package(package,directory=None,upgrade=True):
if upgrade:
args.append('--upgrade')
if 'http_proxy' in os.environ:
args.append('--proxy=%s' % os.environ['http_proxy'])
if 'https_proxy' in os.environ:
args.append('--proxy=%s' % os.environ['https_proxy'])
if directory is not None:
args.append('--target=%s' % directory)
......
......@@ -4,7 +4,7 @@ from fileinput import filename
SOFT = "Org.Asm"
LIB = "orgasm"
PIP_MINVERSION = '1.5'
MODE = "svn" # or "pypi"
MODE = "pypi" # or "svn"
SVNURL = "http://www.grenoble.prabi.fr/public-svn/LECASofts/orgasm/trunk"
......@@ -37280,7 +37280,7 @@ import os.path
import shutil
import sys
import tempfile
import urllib2
import urllib.request, urllib.error, urllib.parse
import imp
import zipimport
import importlib
......@@ -37288,6 +37288,7 @@ import glob
import tarfile
import pkgutil
import stat
import pip
from distutils.errors import DistutilsError
from distutils.version import StrictVersion
......@@ -37320,55 +37321,22 @@ def installModules():
sys.path.insert(0,install_zip)
except:
print >>sys.stderr,'Unable to install %s on your system' % SOFT
print('Unable to install %s on your system' % SOFT, file=sys.stderr)
def cleanModules():
if tmpdir:
shutil.rmtree(tmpdir[0], ignore_errors=True)
def is_pip_installed(minversion=PIP_MINVERSION):
try:
import pip # @UnresolvedImport
print pip.__file__
ok = StrictVersion(pip.__version__) >= StrictVersion(minversion)
except:
ok = False
return ok
def get_a_pip_module(minversion=PIP_MINVERSION):
global local_pip
tmpdir = getTmpDir()
if not local_pip:
pipmodule = importlib.import_module('pip')
# Prepare the CERT certificat for https download
cert_path = os.path.join(tmpdir, "cacert.pem")
with open(cert_path, "wb") as cert:
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
os.environ.setdefault("PIP_CERT", cert_path)
local_pip.append(pipmodule)
return local_pip[0]
def pip_download_package(package,pip=None):
def pip_download_package(package):
tmpdir = getTmpDir()
if pip is None:
pip = get_a_pip_module()
args = ['install']
if 'http_proxy' in os.environ:
if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
os.environ['https_proxy']=os.environ['http_proxy']
if 'https_proxy' in os.environ:
args.append('--proxy=%s' % os.environ['http_proxy'])
args.append('--download=%s' % tmpdir)
......@@ -37405,8 +37373,7 @@ def svndownload():
def pypidownload():
global SOFT
pip = get_a_pip_module()
filename=pip_download_package(SOFT,pip=pip)
filename=pip_download_package(SOFT)
return filename
......@@ -37439,9 +37406,9 @@ def main():
activate = os.path.join(current,LIB)
with open(activate,"w") as fp:
print >>fp, install_script % (virtualenvname,SOFT,SOFT)
print >>fp
print(install_script % (virtualenvname,SOFT,SOFT),file=fp)
print(file=fp)
st = os.stat(activate)
os.chmod(activate, st.st_mode | stat.S_IEXEC)
......@@ -148,7 +148,7 @@ cdef bint isPalindrome(list path):
if (lp & 1) == 1:
return False
for i in range(lp/2):
for i in range(lp//2):
if path[i]!=-path[-i-1]:
return False
......
......@@ -66,7 +66,7 @@ cdef void reversePath(alignPath* path):
cdef long j
j=path.length
for i in range(path.length/2):
for i in range(path.length//2):
j-=1
path.path[i],path.path[j]=path.path[j],path.path[i]
......
......@@ -188,7 +188,7 @@ cdef list alignReads(readids,Index index,size_t kmer=12,int smin=10,size_t delta
seqs = list(unique)
# nseq = len(readids)
nseq = len(seqs)
nali = nseq * (nseq-1) / 2
nali = nseq * (nseq-1) // 2
hashes =[hashSeq(s,kmer) for s in seqs]
progressBar(1,nali,reset=True,head=bytes("Pairwise alignment %6d x %6d " % (0,0),encoding='ascii'))
......
major = 0
minor = 0
minor = '0a4'
serial= 'alpha'
version = "%2d.%02d.%s" % (major,minor,serial)
version = "%2d.%s" % (major,minor)
--extra-index-url https://pypi.python.org/simple/
Cython>=0.21
Sphinx>=1.2.0
pip>=7.1
Cython>=0.22
Sphinx>=1.3.1
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