예제 #1
0
파일: setup.py 프로젝트: chapmanb/biopython
elif sys.version_info[0] == 3:
    if sys.version_info[:2] < (3, 3):
        #TODO - Turn off old buildbots/travis and make this an error?
        print("WARNING - For Python 3, we strongly recommend Python 3.3.2 or later.")
    if sys.version_info == (3, 3, 1):
        print("WARNING - Rather than Python 3.3.1, we recommend Python 3.3.0, or 3.3.2, or later.")
    import do2to3
    python3_source = "build/py%i.%i" % sys.version_info[:2]
    if "clean" in sys.argv:
        if os.path.isdir(python3_source):
            shutil.rmtree(python3_source)
        del python3_source  # so we don't try to change to it below
    else:
        if not os.path.isdir("build"):
            os.mkdir("build")
        do2to3.main(".", python3_source)
    # Ugly hack to make pip work with Python 3, from 2to3 numpy setup:
    # https://github.com/numpy/numpy/blob/bb726ca19f434f5055c0efceefe48d89469fcbbe/setup.py#L172
    # Explanation: pip messes with __file__ which interacts badly with the
    # change in directory due to the 2to3 conversion. Therefore we restore
    # __file__ to what it would have been otherwise.
    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
    global __file__
    __file__ = os.path.join(os.curdir, os.path.basename(__file__))
    if '--egg-base' in sys.argv:
        # Change pip-egg-info entry to absolute path, so pip can find it
        # after changing directory.
        idx = sys.argv.index('--egg-base')
        if sys.argv[idx + 1] == 'pip-egg-info':
            sys.argv[idx + 1] = os.path.join(local_path, 'pip-egg-info')
예제 #2
0
if sys.version_info[:2] < (2, 5):
    print ("Biopython requires Python 2.5 or better (but not Python 3 " \
          + "yet).  Python %d.%d detected" % sys.version_info[:2])
    sys.exit(-1)
elif sys.version_info[0] == 3:
    print("WARNING - Biopython does not yet officially support Python 3")
    import do2to3
    python3_source = "build/py%i.%i" % sys.version_info[:2]
    if "clean" in sys.argv:
        if os.path.isdir(python3_source):
            shutil.rmtree(python3_source)
        del python3_source  #so we don't try to change to it below
    else:
        if not os.path.isdir("build"):
            os.mkdir("build")
        do2to3.main(".", python3_source)

# use setuptools, falling back on core modules if not found
try:
    from setuptools import setup, Command
    from setuptools.command.install import install
    from setuptools.command.build_py import build_py
    from setuptools.command.build_ext import build_ext
    from setuptools.extension import Extension
    _SETUPTOOLS = True
except ImportError:
    from distutils.core import setup
    from distutils.core import Command
    from distutils.command.install import install
    from distutils.command.build_py import build_py
    from distutils.command.build_ext import build_ext