コード例 #1
0
ファイル: __init__.py プロジェクト: drifter-cao/citcoms
def main(argv):
    """Install or upgrade merlin"""

    try:
        import merlin
    except ImportError:
        egg = None
        try:
            egg = download_merlin(delay=0)
            sys.path.insert(0,egg)
            from merlin import main
            return main(['install'] + list(argv) + [egg])   # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)

    import merlin
    try:
        merlin.require(reqSpec)
    except merlin.VersionConflict:
        from merlin import main
        main(list(argv)+[download_merlin(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from merlin import main
            main(['install'] + argv)
        else:
            print "Merlin version",branch,"has been installed."
コード例 #2
0
ファイル: __init__.py プロジェクト: drifter-cao/citcoms
def use_merlin(package_index=default_url, to_dir=os.curdir, download_delay=15):
    """Automatically find/download merlin and make it available on sys.path

    `package_index` is a URL (ending with a '/') which contains merlin
    eggs.  `to_dir` is the directory where merlin will be downloaded,
    if it is not already available.  If `download_delay` is specified,
    it should be the number of seconds that will be paused before
    initiating a download, should one be required.  If an older
    version of merlin is installed, this routine will print a message
    to ``sys.stderr`` and raise SystemExit in an attempt to abort the
    calling script.
    """
    try:
        import merlin
    except ImportError:
        egg = download_merlin(package_index, to_dir, download_delay)
        sys.path.insert(0, egg)
        import merlin; merlin.bootstrap_install_from = egg

    try:
        merlin.require(reqSpec)

    except merlin.VersionConflict, e:
        # XXX could we install in a subprocess here?
        print >>sys.stderr, (
            "The required version of merlin (v%s) is not available, and\n"
            "can't be installed while this script is running. Please install\n"
            " a more recent version first.\n\n(Currently using %r)"
        ) % (branch, e.args[0])
        sys.exit(2)
コード例 #3
0
ファイル: __init__.py プロジェクト: bmi-forum/bmi-pyre
def use_merlin(package_index=default_url, to_dir=os.curdir, download_delay=15):
    """Automatically find/download merlin and make it available on sys.path

    `package_index` is a URL (ending with a '/') which contains merlin
    eggs.  `to_dir` is the directory where merlin will be downloaded,
    if it is not already available.  If `download_delay` is specified,
    it should be the number of seconds that will be paused before
    initiating a download, should one be required.  If an older
    version of merlin is installed, this routine will print a message
    to ``sys.stderr`` and raise SystemExit in an attempt to abort the
    calling script.
    """

    def bootstrap():
        egg = download_merlin(package_index, to_dir, download_delay)
        sys.path.insert(0, egg)
        import merlin; merlin.bootstrap_install_from = egg

    def rebootstrap():
        del sys.modules['merlin']
        bootstrap()

    try:
        import merlin
        merlin.require(reqSpec)
    except ImportError:
        bootstrap()
    except AttributeError:
        # 'merlin' is pythia's merlin
        del merlin
        rebootstrap()
    except merlin.VersionConflict:
        # 'merlin' is a merlin from a different branch
        del merlin
        rebootstrap()
コード例 #4
0
def use_merlin(package_index=default_url, to_dir=os.curdir, download_delay=15):
    """Automatically find/download merlin and make it available on sys.path

    `package_index` is a URL (ending with a '/') which contains merlin
    eggs.  `to_dir` is the directory where merlin will be downloaded,
    if it is not already available.  If `download_delay` is specified,
    it should be the number of seconds that will be paused before
    initiating a download, should one be required.  If an older
    version of merlin is installed, this routine will print a message
    to ``sys.stderr`` and raise SystemExit in an attempt to abort the
    calling script.
    """
    def bootstrap():
        egg = download_merlin(package_index, to_dir, download_delay)
        sys.path.insert(0, egg)
        import merlin
        merlin.bootstrap_install_from = egg

    def rebootstrap():
        del sys.modules['merlin']
        bootstrap()

    try:
        import merlin
        merlin.require(reqSpec)
    except ImportError:
        bootstrap()
    except AttributeError:
        # 'merlin' is pythia's merlin
        del merlin
        rebootstrap()
    except merlin.VersionConflict:
        # 'merlin' is a merlin from a different branch
        del merlin
        rebootstrap()
コード例 #5
0
def main(argv):
    """Install or upgrade merlin"""

    try:
        import merlin
    except ImportError:
        egg = None
        try:
            egg = download_merlin(delay=0)
            sys.path.insert(0, egg)
            from merlin import main
            return main(['install'] + list(argv) + [egg])  # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)

    import merlin
    try:
        merlin.require(reqSpec)
    except merlin.VersionConflict:
        from merlin import main
        main(list(argv) + [download_merlin(delay=0)])
        sys.exit(0)  # try to force an exit
    else:
        if argv:
            from merlin import main
            main(['install'] + argv)
        else:
            print "Merlin version", branch, "has been installed."
コード例 #6
0
ファイル: setup.py プロジェクト: drifter-cao/citcoms
from archimedes import use_merlin
use_merlin()

from merlin import setup, find_packages, require

install_requires = ['pythia[mpi] >= 0.8.1.0, < 0.8.2a']

import os
want_exchanger = os.environ.get('want_exchanger', 'auto')
exchanger = "Exchanger >= 1, < 2a"
if want_exchanger == 'auto':
    # Use Exchanger if it's available.
    try:
        require(exchanger)
    except Exception, e:
        pass
    else:
        install_requires.append(exchanger)
elif want_exchanger == 'yes':
    # Require Exchanger.
    install_requires.append(exchanger)

setup(
    
    name = 'CitcomS', 
    version = '3.2',

    zip_safe = False,
    packages = find_packages(),
    
コード例 #7
0
ファイル: setup.py プロジェクト: ojashvirautela/citcoms
from archimedes import use_merlin
use_merlin()

from merlin import setup, find_packages, require

install_requires = ['pythia[mpi] >= 0.8.1.0, < 0.8.2a']

import os
want_exchanger = os.environ.get('want_exchanger', 'auto')
exchanger = "Exchanger >= 1, < 2a"
if want_exchanger == 'auto':
    # Use Exchanger if it's available.
    try:
        require(exchanger)
    except Exception, e:
        pass
    else:
        install_requires.append(exchanger)
elif want_exchanger == 'yes':
    # Require Exchanger.
    install_requires.append(exchanger)

setup(
    
    name = 'CitcomS', 
    version = '3.1',

    zip_safe = False,
    packages = find_packages(),