Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-11-29 11:40:40 +0100
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-11-29 13:06:22 +0000
commitb9af02ccb123be3ec4d7ec47b592b3722e7eb1bf (patch)
treeca2523c6574db6bddeeab738ab2772bf48dddca4 /sources/pyside-tools/deploy.py
parent3fca012c50e978c2bdc0ed5841fca8227e79b23c (diff)
Refactoring: deploy tool
- Move code sections from deploy.py into config.py - Add check to find .pyproject file and use the files within it to identify project files eg: QML files, Python files - Remove redundant colon in the log messages Pick-to: 6.4 Task-number: PYSIDE-1612 Change-Id: Id92b6caa15da446196196192d117de00518e5cb9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside-tools/deploy.py')
-rw-r--r--sources/pyside-tools/deploy.py76
1 files changed, 29 insertions, 47 deletions
diff --git a/sources/pyside-tools/deploy.py b/sources/pyside-tools/deploy.py
index 2dde34ad3..a8d3e2b61 100644
--- a/sources/pyside-tools/deploy.py
+++ b/sources/pyside-tools/deploy.py
@@ -50,7 +50,7 @@ def clean(purge_path: Path):
"""remove the generated deployment files"""
if purge_path.exists():
shutil.rmtree(purge_path)
- logging.info("[DEPLOY]: deployment directory purged")
+ logging.info("[DEPLOY] deployment directory purged")
else:
print(f"{purge_path} does not exist")
@@ -94,47 +94,35 @@ if __name__ == "__main__":
else:
config_file = Path.cwd() / "pysidedeploy.spec"
- final_exec_path = None
- config = Config(config_file=config_file)
-
- # set if available, else fetch from config_file
- source_file = Path(
- config.set_or_fetch(config_property_val=args.main_file, config_property_key="input_file")
- )
-
- if config.project_dir:
- source_file = config.project_dir / source_file
-
- generated_files_path = source_file.parent / "deployment"
- if generated_files_path.exists():
- clean(generated_files_path)
-
- logging.info("[DEPLOY]: Start")
+ logging.info("[DEPLOY] Start")
try:
python = None
- python_path = config.get_value("python", "python_path")
- if python_path and Path(python_path).exists():
- python = PythonExecutable(Path(python_path), dry_run=args.dry_run)
- else:
- # checking if inside virtual environment
- if not PythonExecutable.is_venv():
- if not args.force:
- response = input("Not in virtualenv. Do you want to create one? [Y/n]")
- else:
- response = "no"
-
- if response.lower() in "yes":
- # creating new virtual environment
- python = PythonExecutable(create_venv=True, dry_run=args.dry_run)
- logging.info("[DEPLOY]: virutalenv created")
-
- # in venv or user entered no
- if not python:
- python = PythonExecutable(dry_run=args.dry_run)
- logging.info(f"[DEPLOY]: using python at {sys.executable}")
-
- config.set_value("python", "python_path", str(python.exe))
+ # checking if inside virtual environment
+ if not PythonExecutable.is_venv():
+ if not args.force:
+ response = input("Not in virtualenv. Do you want to create one? [Y/n]")
+ else:
+ response = "no"
+
+ if response.lower() in "yes":
+ # creating new virtual environment
+ python = PythonExecutable(create_venv=True, dry_run=args.dry_run)
+ logging.info("[DEPLOY] virutalenv created")
+
+ # in venv or user entered no
+ if not python:
+ python = PythonExecutable(dry_run=args.dry_run)
+ logging.info(f"[DEPLOY] using python at {sys.executable}")
+
+ config = Config(config_file=config_file, source_file=args.main_file,
+ python_exe=python.exe, dry_run=args.dry_run)
+
+ source_file = config.project_dir / config.source_file
+
+ generated_files_path = source_file.parent / "deployment"
+ if generated_files_path.exists():
+ clean(generated_files_path)
if not args.init and not args.dry_run:
# install packages needed for deployment
@@ -145,12 +133,6 @@ if __name__ == "__main__":
if sys.platform.startswith("linux"):
python.install(packages=["patchelf"])
- # identify and set qml files
- config.find_and_set_qml_files()
-
- if not config.project_dir:
- config.find_and_set_project_dir()
-
if config.project_dir == Path.cwd():
final_exec_path = config.project_dir.relative_to(Path.cwd())
else:
@@ -166,7 +148,7 @@ if __name__ == "__main__":
if args.init:
# config file created above. Exiting.
- logging.info(f"[DEPLOY]: Config file {args.config_file} created")
+ logging.info(f"[DEPLOY]: Config file {config.config_file} created")
sys.exit(0)
# create executable
@@ -192,4 +174,4 @@ if __name__ == "__main__":
)
clean(generated_files_path)
- logging.info("[DEPLOY]: End")
+ logging.info("[DEPLOY] End")