1616from planemo import galaxy_run
1717from planemo .io import warn
1818from planemo .io import shell
19+ from planemo .io import shell_join
1920from planemo .io import write_file
2021from planemo .io import kill_pid_file
2122from planemo .io import wait_on
9293DOWNLOADABLE_MIGRATION_VERSIONS = [127 , 120 , 117 ]
9394LATEST_URL = DOWNLOADS_URL + "latest.sqlite"
9495
95- PIP_INSTALL_CMD = "[ -d .venv ] && . .venv/bin/activate && pip install %s"
96+ PIP_INSTALL_CMD = "pip install %s"
97+
98+ COMMAND_STARTUP_COMMAND = "./scripts/common_startup.sh ${COMMON_STARTUP_ARGS}"
9699
97100FAILED_TO_FIND_GALAXY_EXCEPTION = (
98101 "Failed to find Galaxy root directory - please explicitly specify one "
@@ -523,21 +526,21 @@ def _install_galaxy(ctx, config_directory, kwds):
523526 if not kwds .get ("no_cache_galaxy" , False ):
524527 _install_galaxy_via_git (ctx , config_directory , kwds )
525528 else :
526- _install_galaxy_via_download (config_directory , kwds )
529+ _install_galaxy_via_download (ctx , config_directory , kwds )
527530
528531
529- def _install_galaxy_via_download (config_directory , kwds ):
532+ def _install_galaxy_via_download (ctx , config_directory , kwds ):
530533 branch = _galaxy_branch (kwds )
531534 tar_cmd = "tar -zxvf %s" % branch
532535 command = galaxy_run .DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
533- _install_with_command (config_directory , command , kwds )
536+ _install_with_command (ctx , config_directory , command , kwds )
534537
535538
536539def _install_galaxy_via_git (ctx , config_directory , kwds ):
537540 gx_repo = _ensure_galaxy_repository_available (ctx , kwds )
538541 branch = _galaxy_branch (kwds )
539542 command = git .command_clone (ctx , gx_repo , "galaxy-dev" , branch = branch )
540- _install_with_command (config_directory , command , kwds )
543+ _install_with_command (ctx , config_directory , command , kwds )
541544
542545
543546def _build_eggs_cache (ctx , env , kwds ):
@@ -557,7 +560,7 @@ def _galaxy_branch(kwds):
557560 return branch
558561
559562
560- def _install_with_command (config_directory , command , kwds ):
563+ def _install_with_command (ctx , config_directory , command , kwds ):
561564 # TODO: --watchdog
562565 pip_installs = []
563566 if kwds .get ("cwl" , False ):
@@ -566,15 +569,17 @@ def _install_with_command(config_directory, command, kwds):
566569 pip_install_command = PIP_INSTALL_CMD % " " .join (pip_installs )
567570 else :
568571 pip_install_command = ""
569- install_cmds = [
572+ setup_venv_command = galaxy_run .setup_venv (ctx , kwds )
573+ install_cmd = shell_join (
570574 "cd %s" % config_directory ,
571575 command ,
572576 "cd galaxy-dev" ,
573- "type virtualenv >/dev/null 2>&1 && virtualenv .venv" ,
577+ setup_venv_command ,
574578 pip_install_command ,
575- galaxy_run .ACTIVATE_COMMAND ,
576- ]
577- shell (";" .join ([c for c in install_cmds if c ]))
579+ galaxy_run .setup_common_startup_args (),
580+ COMMAND_STARTUP_COMMAND ,
581+ )
582+ shell (install_cmd )
578583
579584
580585def _ensure_galaxy_repository_available (ctx , kwds ):
0 commit comments