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)
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") database_connection = DATABASE_LOCATION_TEMPLATE % database_location return { "database_type": database_type, "database_connection": database_connection, "engine": "galaxy", }
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
def __init__(self, conda_prefix=None, conda_exec=None, shell_exec=None, debug=False, ensure_channels='', condarc_override=None, use_path_exec=USE_PATH_EXEC_DEFAULT, copy_dependencies=False, use_local=USE_LOCAL_DEFAULT): self.condarc_override = condarc_override if not conda_exec and use_path_exec: conda_exec = commands.which("conda") if conda_exec: conda_exec = os.path.normpath(conda_exec) self.conda_exec = conda_exec self.debug = debug self.shell_exec = shell_exec or commands.shell self.copy_dependencies = copy_dependencies if conda_prefix is None: info = self.conda_info() if info and "default_prefix" in info: conda_prefix = info["default_prefix"] if conda_prefix is None: conda_prefix = find_conda_prefix(conda_prefix) self.conda_prefix = conda_prefix if conda_exec is None: self.conda_exec = self._bin("conda") if ensure_channels: if not isinstance(ensure_channels, list): ensure_channels = [c for c in ensure_channels.split(",") if c] else: ensure_channels = None self.ensure_channels = ensure_channels self._conda_version = None self._miniconda_version = None self._conda_build_available = None self.use_local = use_local
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_ids = ['mulled_example_multi_1'] endpoint = "dependency_resolvers/toolbox/install" data = { 'tool_ids': json.dumps(tool_ids), 'resolver_type': resolver_type, 'container_type': self.container_type, 'include_containers': True } create_response = self._post(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) create_response = self._get("dependency_resolvers/toolbox", data={ 'tool_ids': tool_ids, 'container_type': self.container_type, 'include_containers': True, 'index_by': 'tools' }, admin=True) response = create_response.json() assert len(response) == 1 status = response[0]['status'] assert status[0]['model_class'] == 'ContainerDependency' assert status[0]['dependency_type'] == self.container_type assert status[0]['container_description']['identifier'].startswith( 'quay.io/local/mulled-v2-')
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. """ # Create a virtualenv with the selected python version. 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) else: python = sys.executable or 'python' virtualenv_on_path = which('virtualenv') if virtualenv_on_path: command = [virtualenv_on_path, virtualenv_path, '-p', python] else: command = [python, '-m', 'venv', virtualenv_path] return " ".join(command)
def skip_unless_executable(executable): if which(executable): return _identity return pytest.mark.skip("PATH doesn't contain executable %s" % executable)
def skip_if_container_type_unavailable(cls): if not which(cls.container_type): raise unittest.SkipTest("Executable '%s' not found on PATH" % cls.container_type)