9292DOWNLOADABLE_MIGRATION_VERSIONS = [127 , 120 , 117 ]
9393LATEST_URL = DOWNLOADS_URL + "latest.sqlite"
9494
95+ PIP_INSTALL_CMD = "[ -d .venv ] && . .venv/bin/activate && pip install %s"
96+
9597FAILED_TO_FIND_GALAXY_EXCEPTION = (
9698 "Failed to find Galaxy root directory - please explicitly specify one "
9799 "with --galaxy_root."
@@ -185,6 +187,7 @@ def config_join(*args):
185187 database_auto_migrate = "True" ,
186188 cleanup_job = "never" ,
187189 master_api_key = "${master_api_key}" ,
190+ enable_beta_tool_formats = "True" ,
188191 id_secret = "${id_secret}" ,
189192 log_level = "${log_level}" ,
190193 debug = "${debug}" ,
@@ -381,11 +384,15 @@ def _check_galaxy(ctx, **kwds):
381384
382385
383386def _find_galaxy_root (ctx , ** kwds ):
384- galaxy_root = kwds .get ("galaxy_root" , None )
387+ root_prop = "galaxy_root"
388+ cwl = kwds .get ("cwl" , False )
389+ if cwl :
390+ root_prop = "cwl_galaxy_root"
391+ galaxy_root = kwds .get (root_prop , None )
385392 if galaxy_root :
386393 return galaxy_root
387- elif ctx .global_config .get ("galaxy_root" , None ):
388- return ctx .global_config ["galaxy_root" ]
394+ elif ctx .global_config .get (root_prop , None ):
395+ return ctx .global_config [root_prop ]
389396 else :
390397 par_dir = os .getcwd ()
391398 while True :
@@ -489,16 +496,17 @@ def _install_galaxy(ctx, config_directory, kwds):
489496
490497
491498def _install_galaxy_via_download (config_directory , kwds ):
492- command = galaxy_run .DOWNLOAD_GALAXY + "; tar -zxvf dev | tail"
493- _install_with_command (config_directory , command )
499+ branch = _galaxy_branch (kwds )
500+ tar_cmd = "tar -zxvf %s" % branch
501+ command = galaxy_run .DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
502+ _install_with_command (config_directory , command , kwds )
494503
495504
496505def _install_galaxy_via_git (ctx , config_directory , kwds ):
497- _ensure_galaxy_repository_available (ctx )
498- workspace = ctx .workspace
499- gx_repo = os .path .join (workspace , "gx_repo" )
500- command = git .command_clone (ctx , gx_repo , "galaxy-dev" )
501- _install_with_command (config_directory , command )
506+ gx_repo = _ensure_galaxy_repository_available (ctx , kwds )
507+ branch = _galaxy_branch (kwds )
508+ command = git .command_clone (ctx , gx_repo , "galaxy-dev" , branch = branch )
509+ _install_with_command (config_directory , command , kwds )
502510
503511
504512def _build_eggs_cache (ctx , env , kwds ):
@@ -511,27 +519,50 @@ def _build_eggs_cache(ctx, env, kwds):
511519 env ["GALAXY_EGGS_PATH" ] = eggs_path
512520
513521
514- def _install_with_command (config_directory , command ):
522+ def _galaxy_branch (kwds ):
523+ # TODO: implement generic --branch argument
524+ cwl = kwds .get ("cwl" , False )
525+ branch = "cwl" if cwl else "dev"
526+ return branch
527+
528+
529+ def _install_with_command (config_directory , command , kwds ):
530+ # TODO: --watchdog
531+ pip_installs = []
532+ if kwds .get ("cwl" , False ):
533+ pip_installs .append ("cwltool" )
534+ if pip_installs :
535+ pip_install_command = PIP_INSTALL_CMD % " " .join (pip_installs )
536+ else :
537+ pip_install_command = ""
515538 install_cmds = [
516539 "cd %s" % config_directory ,
517540 command ,
518541 "cd galaxy-dev" ,
519542 "type virtualenv >/dev/null 2>&1 && virtualenv .venv" ,
543+ pip_install_command ,
520544 galaxy_run .ACTIVATE_COMMAND ,
521545 ]
522- shell (";" .join (install_cmds ))
546+ shell (";" .join ([ c for c in install_cmds if c ] ))
523547
524548
525- def _ensure_galaxy_repository_available (ctx ):
549+ def _ensure_galaxy_repository_available (ctx , kwds ):
526550 workspace = ctx .workspace
551+ cwl = kwds .get ("cwl" , False )
527552 gx_repo = os .path .join (workspace , "gx_repo" )
553+ if cwl :
554+ gx_repo += "_cwl"
528555 if os .path .exists (gx_repo ):
529556 # Attempt fetch - but don't fail if not interweb, etc...
530557 shell ("git --git-dir %s fetch >/dev/null 2>&1" % gx_repo )
531558 else :
532- remote_repo = "https://github.com/galaxyproject/galaxy"
559+ if cwl :
560+ remote_repo = "https://github.com/common-workflow-language/galaxy"
561+ else :
562+ remote_repo = "https://github.com/galaxyproject/galaxy"
533563 command = git .command_clone (ctx , remote_repo , gx_repo , bare = True )
534564 shell (command )
565+ return gx_repo
535566
536567
537568def _build_env_for_galaxy (properties , template_args ):
0 commit comments