示例#1
0
def create_command(virtualenv_path):
    """ If virtualenv is on Planemo's path use it, otherwise use the planemo
    subcommand virtualenv to create the virtualenv.
    """
    planemo_path = os.path.abspath(sys.argv[0])
    virtualenv_on_path = which("virtualenv")
    if virtualenv_on_path:
        base_command = [
            os.path.abspath(virtualenv_on_path),
        ]
    else:
        base_command = [
            planemo_path, "virtualenv",
        ]

    command = base_command

    # If planemo is running in a Python 3 environment but Python 2.7
    # is available for Galaxy, use it.
    python27 = which("python2.7")
    if python27:
        python27 = os.path.abspath(python27)
        command.extend(["-p", python27])
    command.append(virtualenv_path)
    return " ".join(command)
示例#2
0
def create_command(virtualenv_path):
    """ If virtualenv is on Planemo's path use it, otherwise use the planemo
    subcommand virtualenv to create the virtualenv.
    """
    planemo_path = os.path.abspath(sys.argv[0])
    virtualenv_on_path = which("virtualenv")
    if virtualenv_on_path:
        base_command = [
            os.path.abspath(virtualenv_on_path),
        ]
    else:
        base_command = [
            planemo_path,
            "virtualenv",
        ]

    command = base_command

    # If planemo is running in a Python 3 environment but Python 2.7
    # is available for Galaxy, use it.
    python27 = which("python2.7")
    if python27:
        python27 = os.path.abspath(python27)
        command.extend(["-p", python27])
    command.append(virtualenv_path)
    return " ".join(command)
示例#3
0
def find_engine(config):
    nodejs_path = getattr(config, "nodejs_path", None)
    if nodejs_path is None:
        nodejs_path = which("nodejs") or which("node") or None
    if nodejs_path is None:
        raise Exception("nodejs or node not found on PATH")
    return nodejs_path
示例#4
0
def _create_profile_local(ctx, profile_directory, profile_name, kwds):
    database_type = kwds.get("database_type", "auto")
    if database_type == "auto":
        if which("psql"):
            database_type = "postgres"
        elif which("docker"):
            database_type = "postgres_docker"
        else:
            database_type = "sqlite"

    if database_type != "sqlite":
        database_source = create_database_source(**kwds)
        database_identifier = _profile_to_database_identifier(profile_name)
        database_source.create_database(
            database_identifier,
        )
        database_connection = database_source.sqlalchemy_url(database_identifier)
    else:
        database_location = os.path.join(profile_directory, "galaxy.sqlite")
        attempt_database_preseed(ctx, None, database_location, **kwds)
        database_connection = DATABASE_LOCATION_TEMPLATE % database_location

    return {
        "database_type": database_type,
        "database_connection": database_connection,
        "engine": "galaxy",
    }
示例#5
0
def create_command(virtualenv_path, galaxy_python_version=None):
    """ If virtualenv is on Planemo's path use it, otherwise use the planemo
    subcommand virtualenv to create the virtualenv.
    """
    planemo_path = os.path.abspath(sys.argv[0])
    virtualenv_on_path = which("virtualenv")
    if virtualenv_on_path:
        base_command = [
            os.path.abspath(virtualenv_on_path),
        ]
    else:
        base_command = [
            planemo_path, "virtualenv",
        ]

    command = base_command

    # Create a virtualenv with the selected python version.
    # default to 2.7
    if galaxy_python_version is None:
        galaxy_python_version = DEFAULT_PYTHON_VERSION
    python = which("python%s" % galaxy_python_version)
    if python:
        python = os.path.abspath(python)
        command.extend(["-p", python])
    command.append(virtualenv_path)
    return " ".join(command)
示例#6
0
def create_command(virtualenv_path, galaxy_python_version=None):
    """ If virtualenv is on Planemo's path use it, otherwise use the planemo
    subcommand virtualenv to create the virtualenv.
    """
    planemo_path = os.path.abspath(sys.argv[0])
    virtualenv_on_path = which("virtualenv")
    if virtualenv_on_path:
        base_command = [
            os.path.abspath(virtualenv_on_path),
        ]
    else:
        base_command = [
            planemo_path,
            "virtualenv",
        ]

    command = base_command

    # Create a virtualenv with the selected python version.
    # default to 2.7
    if galaxy_python_version is None:
        galaxy_python_version = DEFAULT_PYTHON_VERSION
    python = which("python%s" % galaxy_python_version)
    if python:
        python = os.path.abspath(python)
        command.extend(["-p", python])
    command.append(virtualenv_path)
    return " ".join(command)
示例#7
0
def _create_profile_local(ctx, profile_directory, profile_name, kwds):
    database_type = kwds.get("database_type", "auto")
    if database_type == "auto":
        if which("psql"):
            database_type = "postgres"
        elif which("docker"):
            database_type = "postgres_docker"
        else:
            database_type = "sqlite"

    if database_type != "sqlite":
        database_source = create_database_source(**kwds)
        database_identifier = _profile_to_database_identifier(profile_name)
        database_source.create_database(database_identifier, )
        database_connection = database_source.sqlalchemy_url(
            database_identifier)
    else:
        database_location = os.path.join(profile_directory, "galaxy.sqlite")
        attempt_database_preseed(ctx, None, database_location, **kwds)
        database_connection = DATABASE_LOCATION_TEMPLATE % database_location

    return {
        "database_type": database_type,
        "database_connection": database_connection,
        "engine": "galaxy",
    }
示例#8
0
 def test_build_mulled(self):
     if not which('docker'):
         raise unittest.SkipTest("Docker not found on PATH, required for building images via involucro")
     resolver_type = self.build_mulled_resolver
     tool_id = 'mulled_example_multi_1'
     endpoint = "tools/%s/dependencies" % tool_id
     data = {'id': tool_id, 'resolver_type': resolver_type}
     create_response = self._post(endpoint, data=data, admin=True)
     self._assert_status_code_is(create_response, 200)
     response = create_response.json()
     assert any([True for d in response if d['dependency_type'] == self.container_type])
示例#9
0
def create_database_source(**kwds):
    """Return a :class:`planemo.database.DatabaseSource` for configuration."""
    database_type = kwds.get("database_type", "auto")
    if database_type == "auto":
        if which("psql"):
            database_type = "postgres"
        elif which("docker"):
            database_type = "postgres_docker"
        else:
            raise Exception("Cannot find executables for psql or docker, cannot configure a database source.")

    if database_type == "postgres":
        return LocalPostgresDatabaseSource(**kwds)
    elif database_type == "postgres_docker":
        return DockerPostgresDatabaseSource(**kwds)
    # TODO
    # from .sqlite import SqliteDatabaseSource
    # elif database_type == "sqlite":
    #     return SqliteDatabaseSource(**kwds)
    else:
        raise Exception("Unknown database type [%s]." % database_type)
示例#10
0
def create_database_source(**kwds):
    """Return a :class:`planemo.database.DatabaseSource` for configuration."""
    database_type = kwds.get("database_type", "auto")
    if database_type == "auto":
        if which("psql"):
            database_type = "postgres"
        elif which("docker"):
            database_type = "postgres_docker"
        else:
            raise Exception(
                "Cannot find executables for psql or docker, cannot configure a database source."
            )

    if database_type == "postgres":
        return LocalPostgresDatabaseSource(**kwds)
    elif database_type == "postgres_docker":
        return DockerPostgresDatabaseSource(**kwds)
    # TODO
    # from .sqlite import SqliteDatabaseSource
    # elif database_type == "sqlite":
    #     return SqliteDatabaseSource(**kwds)
    else:
        raise Exception("Unknown database type [%s]." % database_type)
示例#11
0
文件: io.py 项目: einon/planemo
def untar_to(url, path, tar_args):
    if which("wget"):
        download_cmd = "wget -q --recursive -O - '%s'"
    else:
        download_cmd = "curl '%s'"
    download_cmd = download_cmd % url
    if tar_args:
        if not os.path.exists(path):
            os.makedirs(path)

        untar_cmd = "tar %s" % tar_args
        shell("%s | %s" % (download_cmd, untar_cmd))
    else:
        shell("%s > '%s'" % (download_cmd, path))
示例#12
0
文件: io.py 项目: nebiolabs/planemo
def untar_to(url, path, tar_args):
    if which("wget"):
        download_cmd = "wget -q --recursive -O - '%s'"
    else:
        download_cmd = "curl '%s'"
    download_cmd = download_cmd % url
    if tar_args:
        if not os.path.exists(path):
            os.makedirs(path)

        untar_cmd = "tar %s" % tar_args
        shell("%s | %s" % (download_cmd, untar_cmd))
    else:
        shell("%s > '%s'" % (download_cmd, path))
示例#13
0
def _handle_default(value, script_name):
    """ There are two potential variants of these scripts,
    the Bash scripts that are meant to be run within PULSAR_ROOT
    for older-style installs and the binaries created by setup.py
    as part of a proper pulsar installation.

    This method first looks for the newer style variant of these
    scripts and returns the full path to them if needed and falls
    back to the bash scripts if these cannot be found.
    """
    if value:
        return value

    installed_script = which("pulsar-%s" % script_name.replace("_", "-"))
    if installed_script:
        return installed_script
    else:
        return "scripts/%s.bash" % script_name
示例#14
0
def _handle_default(value, script_name):
    """ There are two potential variants of these scripts,
    the Bash scripts that are meant to be run within PULSAR_ROOT
    for older-style installs and the binaries created by setup.py
    as part of a proper pulsar installation.

    This method first looks for the newer style variant of these
    scripts and returns the full path to them if needed and falls
    back to the bash scripts if these cannot be found.
    """
    if value:
        return value

    installed_script = which("pulsar-%s" % script_name.replace("_", "-"))
    if installed_script:
        return installed_script
    else:
        return "scripts/%s.bash" % script_name
示例#15
0
def ensure_hub(ctx, **kwds):
    """Ensure ``hub`` is on the system ``PATH``.

    This method will ensure ``hub`` is installed if it isn't available.

    For more information on ``hub`` checkout ...
    """
    hub_path = which("hub")
    if not hub_path:
        planemo_hub_path = os.path.join(ctx.workspace, "hub")
        if not os.path.exists(planemo_hub_path):
            _try_download_hub(planemo_hub_path)

        if not os.path.exists(planemo_hub_path):
            raise Exception(FAILED_TO_DOWNLOAD_HUB)

        hub_path = planemo_hub_path
    return hub_path
示例#16
0
def ensure_hub(ctx, **kwds):
    """Ensure ``hub`` is on the system ``PATH``.

    This method will ensure ``hub`` is installed if it isn't available.

    For more information on ``hub`` checkout ...
    """
    hub_path = which("hub")
    if not hub_path:
        planemo_hub_path = os.path.join(ctx.workspace, "hub")
        if not os.path.exists(planemo_hub_path):
            _try_download_hub(planemo_hub_path)

        if not os.path.exists(planemo_hub_path):
            raise Exception(FAILED_TO_DOWNLOAD_HUB)

        hub_path = planemo_hub_path
    return hub_path
示例#17
0
def skip_unless_executable(executable):
    if which(executable):
        return lambda func: func
    return skip("PATH doesn't contain executable %s" % executable)
示例#18
0
 def enabled(self):
     return bool(which("xmllint"))
示例#19
0
 def enabled(self):
     return bool(which("xmllint"))
示例#20
0
 def setUpClass(cls):
     if not which(cls.container_type):
         raise unittest.SkipTest("Executable '%s' not found on PATH" % cls.container_type)
     super(DockerizedJobsIntegrationTestCase, cls).setUpClass()