diff options
author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-12-19 11:22:48 +0100 |
---|---|---|
committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-12-20 14:20:28 +0100 |
commit | c78ad95f2571ca6bdcccede2a2cfc2c8d5c8932a (patch) | |
tree | 5e90b33c9e0640b594724f1279beceec769a14d0 /sources/pyside-tools | |
parent | c05672ad62214710ffd5dba85bec77a0e4ff7b8d (diff) |
deploy tool: add error when running on a non-project directory
- Before this patch one could run pyside6-deploy on a non-project
directory, which would eventually fail because there is no main
python file or a config file
- This patch adds an error message when neither the config file nor
the main python file is given (or found, incase the file is named
main.py) with the pyside6-deploy command
Pick-to: 6.4
Change-Id: I5e44efecfcdf50f48b5393fbbbd0e1fb721c0409
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside-tools')
-rw-r--r-- | sources/pyside-tools/deploy.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sources/pyside-tools/deploy.py b/sources/pyside-tools/deploy.py index a8d3e2b61..58022ded8 100644 --- a/sources/pyside-tools/deploy.py +++ b/sources/pyside-tools/deploy.py @@ -31,6 +31,7 @@ import sys from pathlib import Path import shutil import traceback +from textwrap import dedent from deploy import Config, PythonExecutable @@ -79,14 +80,26 @@ if __name__ == "__main__": parser.add_argument("--dry-run", action="store_true", help="show the commands to be run") parser.add_argument( - "--keep-deployment-files",action="store_true", - help="keep the generated deployment files generated",) + "--keep-deployment-files", action="store_true", + help="keep the generated deployment files generated") parser.add_argument("-f", "--force", action="store_true", help="force all input prompts") args = parser.parse_args() logging.basicConfig(level=args.loglevel) - config_file = Path(args.config_file) if args.config_file else None + config_file = None + + if args.config_file and Path(args.config_file).exists(): + config_file = Path(args.config_file) + + if not config_file and not args.main_file.exists(): + print(dedent(""" + Directory does not contain main.py file + Please specify the main python entrypoint file or the config file + Run "pyside6-deploy --help" to see info about cli options + + pyside6-deploy exiting...""")) + sys.exit(0) if args.main_file: if args.main_file.parent != Path.cwd(): |