1313from galaxy .containers .docker_model import DockerVolume
1414from galaxy .tools .deps import docker_util
1515from galaxy .tools .deps .commands import argv_to_str
16+ from pkg_resources import parse_version
1617from six import (
1718 add_metaclass ,
1819 iteritems
3435)
3536from planemo .mulled import build_involucro_context
3637from planemo .shed import tool_shed_url
38+ from planemo .virtualenv import DEFAULT_PYTHON_VERSION
3739from .api import (
3840 DEFAULT_MASTER_API_KEY ,
3941 gi ,
@@ -397,6 +399,10 @@ def config_join(*args):
397399 )
398400 _ensure_directory (shed_tool_path )
399401 port = _get_port (kwds )
402+ if parse_version (kwds .get ('galaxy_python_version' , DEFAULT_PYTHON_VERSION )) >= parse_version ('3' ):
403+ # on python 3 we use gunicorn,
404+ # which requires 'main' as server name
405+ server_name = 'main'
400406 template_args = dict (
401407 port = port ,
402408 host = kwds .get ("host" , "127.0.0.1" ),
@@ -941,6 +947,14 @@ def startup_command(self, ctx, **kwds):
941947 run_script += " --server-name %s" % shlex_quote (self .server_name )
942948 server_ini = os .path .join (self .config_directory , "galaxy.ini" )
943949 self .env ["GALAXY_CONFIG_FILE" ] = server_ini
950+ if parse_version (kwds .get ('galaxy_python_version' , DEFAULT_PYTHON_VERSION )) >= parse_version ('3' ):
951+ # We need to start under gunicorn
952+ self .env ['APP_WEBSERVER' ] = 'gunicorn'
953+ self .env ['GUNICORN_CMD_ARGS' ] = "--bind={host}:{port} --name={server_name}" .format (
954+ host = kwds ['host' ],
955+ port = kwds ['port' ],
956+ server_name = self .server_name ,
957+ )
944958 cd_to_galaxy_command = ['cd' , self .galaxy_root ]
945959 return shell_join (
946960 cd_to_galaxy_command ,
@@ -1233,19 +1247,13 @@ def _galaxy_source(kwds):
12331247
12341248
12351249def _install_with_command (ctx , config_directory , command , env , kwds ):
1236- # TODO: --watchdog
1237- pip_installs = []
1238- if pip_installs :
1239- pip_install_command = ['pip' , 'install' ] + pip_installs
1240- else :
1241- pip_install_command = ""
12421250 setup_venv_command = setup_venv (ctx , kwds )
1251+ env ['__PYVENV_LAUNCHER__' ] = ''
12431252 install_cmd = shell_join (
12441253 ['cd' , config_directory ],
12451254 command ,
12461255 ['cd' , 'galaxy-dev' ],
12471256 setup_venv_command ,
1248- pip_install_command ,
12491257 setup_common_startup_args (),
12501258 COMMAND_STARTUP_COMMAND ,
12511259 )
@@ -1255,15 +1263,20 @@ def _install_with_command(ctx, config_directory, command, env, kwds):
12551263def _ensure_galaxy_repository_available (ctx , kwds ):
12561264 workspace = ctx .workspace
12571265 cwl = kwds .get ("cwl" , False )
1258- gx_repo = os .path .join (workspace , "gx_repo" )
1266+ galaxy_source = kwds .get ('galaxy_source' )
1267+ if galaxy_source and galaxy_source != DEFAULT_GALAXY_SOURCE :
1268+ sanitized_repo_name = "" .join (c if c .isalnum () else '_' for c in kwds ['galaxy_source' ]).rstrip ()[:255 ]
1269+ gx_repo = os .path .join (workspace , "gx_repo_%s" % sanitized_repo_name )
1270+ else :
1271+ gx_repo = os .path .join (workspace , "gx_repo" )
12591272 if cwl :
12601273 gx_repo += "_cwl"
12611274 if os .path .exists (gx_repo ):
12621275 # Attempt fetch - but don't fail if not interweb, etc...
1263- shell ("git --git-dir %s fetch >/dev/null 2>&1" % gx_repo )
1276+ shell ("git --git-dir %s remote update >/dev/null 2>&1" % gx_repo )
12641277 else :
12651278 remote_repo = _galaxy_source (kwds )
1266- command = git .command_clone (ctx , remote_repo , gx_repo , bare = True )
1279+ command = git .command_clone (ctx , remote_repo , gx_repo , mirror = True )
12671280 shell (command )
12681281 return gx_repo
12691282
0 commit comments