diff options
| author | Shyamnath Premnadh <shyamnath.premnadh@qt.io> | 2023-03-20 10:51:56 +0100 |
|---|---|---|
| committer | Shyamnath Premnadh <shyamnath.premnadh@qt.io> | 2023-03-27 09:01:18 +0100 |
| commit | 4d4f744c570d2feb79163051d2fd4c73336f1758 (patch) | |
| tree | 372f4e18fe6978d1441164352836e88f8b1647ab /sources/pyside-tools/deploy_lib/python_helper.py | |
| parent | 5529853210de3e51b2ad3c636ebee4a4d77aa54e (diff) | |
Deployment Tool: Remove create_venv + fix --dry-run/--init
- As the deployment tool's code base grows larger, I realized that
the ability to create a venv using pyside6-deploy was a bit of
over engineering. There are instances where I have to use the
current Python interpreter to fetch some information from the
newly created venv Python, which results in weird code.
Note: The tool would still work even if the user is using a
globally installed Python interpreter with PySide6 installed.
- Now, the user is warned if he is not in a virtual environment and
prompted the requirement to install further Python packages. If
the user input's "no", then the tool exits.
- dry_run used to create an empty 'pysidedeploy.spec' which can
wreck the normal deployment process. This is fixed by
pyside6-deploy using the 'default.spec' instead of creating
a new 'pysidedeploy.spec'.
Fixes: PYSIDE-2258
Task-number: PYSIDE-1612
Pick-to: 6.4 6.5
Change-Id: I376d2a6aea9f93582eab7a904a81f48426bfee18
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/python_helper.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/python_helper.py | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/sources/pyside-tools/deploy_lib/python_helper.py b/sources/pyside-tools/deploy_lib/python_helper.py index cc9a448b0..2fc0236bc 100644 --- a/sources/pyside-tools/deploy_lib/python_helper.py +++ b/sources/pyside-tools/deploy_lib/python_helper.py @@ -19,11 +19,9 @@ class PythonExecutable: Wrapper class around Python executable """ - def __init__(self, python_path=None, create_venv=False, dry_run=False): + def __init__(self, python_path=None, dry_run=False): self.exe = python_path if python_path else Path(sys.executable) self.dry_run = dry_run - if create_venv: - self.__create_venv() self.nuitka = Nuitka(nuitka=[os.fspath(self.exe), "-m", "nuitka"]) @property @@ -39,21 +37,6 @@ class PythonExecutable: venv = os.environ.get("VIRTUAL_ENV") return True if venv else False - def __create_venv(self): - self.install("virtualenv") - if not self.is_venv(): - run_command( - command=[self.exe, "-m", "venv", Path.cwd() / "deployment" / "venv"], - dry_run=self.dry_run, - ) - venv_path = Path(os.environ["VIRTUAL_ENV"]) - if sys.platform == "win32": - self.exe = venv_path / "Scripts" / "python.exe" - elif sys.platform in ["linux", "darwin"]: - self.exe = venv_path / "bin" / "python" - else: - logging.info("[DEPLOY] You are already in virtual environment!") - def install(self, packages: list = None): for package in packages: package_info = package.split('==') @@ -104,4 +87,3 @@ class PythonExecutable: ) return command_str - |
