comparison env/lib/python3.9/site-packages/planemo/virtualenv.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """ Utilities for using virtualenv as library and planemo command.
2 """
3 from __future__ import absolute_import
4
5 import os
6 import sys
7
8 from galaxy.util.commands import which
9
10 DEFAULT_PYTHON_VERSION = os.environ.get("PLANEMO_DEFAULT_PYTHON_VERSION", "3")
11
12
13 def create_command(virtualenv_path, galaxy_python_version=None):
14 """ If virtualenv is on Planemo's path use it, otherwise use the planemo
15 subcommand virtualenv to create the virtualenv.
16 """
17 # Create a virtualenv with the selected python version.
18 if galaxy_python_version is None:
19 galaxy_python_version = DEFAULT_PYTHON_VERSION
20 python = which("python%s" % galaxy_python_version)
21 if python:
22 python = os.path.abspath(python)
23 else:
24 python = sys.executable or 'python'
25 command = [python, '-m', 'venv', virtualenv_path]
26 return " ".join(command)