aboutsummaryrefslogtreecommitdiffstats
path: root/create_wheels.py
diff options
context:
space:
mode:
authorAdrian Herrmann <adrian.herrmann@qt.io>2023-01-25 12:18:00 +0100
committerAdrian Herrmann <adrian.herrmann@qt.io>2023-02-10 14:53:41 +0100
commit791deac569c0147167eabfb83be43e4fd03b83a6 (patch)
tree319eac5f83972180ff779f7a57e51e86e0a321dc /create_wheels.py
parent5abd98b6552d50f28c334a7bdb80a41065421e97 (diff)
create_wheels: Add --build-dir argument
If PySide was built outside a venv, the build directory has a different naming scheme and --env as the name of the option is a bit unintuitive. Add a --build-dir option to directly provide the relative path of the build directory. Additionally, if no valid build directory or env name were given, make it clearer to users that create_wheels is using the first valid directory it could find, which might not be the wanted one. Both --env and --build-dir options are now better explained upon running --help. Pick-to: 6.4 Change-Id: Idac9d48c85b2d0b5611d3f28f0f04da5ec7e3d3a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'create_wheels.py')
-rw-r--r--create_wheels.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/create_wheels.py b/create_wheels.py
index ebf4fe8f9..3fc11729e 100644
--- a/create_wheels.py
+++ b/create_wheels.py
@@ -250,18 +250,37 @@ def get_build_directory(options: Namespace):
return result
if options.env:
raise Exception(f'Invalid environment "{options.env}" passed')
+ # Try explicit build-dir
+ if options.build_dir and (Path(options.build_dir) / PACKAGE_FOR_WHEELS).is_dir():
+ return Path(options.build_dir)
# Fallback to existing dirs (skip "config.tests")
for d in build_dir.glob("*"):
if (d / PACKAGE_FOR_WHEELS).is_dir():
+ print(
+ "No valid environment or build directory was specified, so create_wheels is using "
+ "the first valid directory it could find on its own. If this is not the one you "
+ "want, use the --env or --build-dir options to provide it explicitly."
+ )
return d
raise Exception("Unable to determine build directory, no matching virtual environment found")
if __name__ == "__main__":
- # Command line option to find the build/<envname>a/package_for_wheels
parser = ArgumentParser()
- parser.add_argument("--env", type=str, default=None)
+ # Command line option to find the build/<envname>a/package_for_wheels
+ parser.add_argument(
+ "--env", type=str, default=None,
+ help="The env's name from which PySide was built such that the "
+ "build directory is 'build/<envname>' (must contain a "
+ "'package_for_wheels' folder"
+ )
+ # Alternatively, <build-dir> (must contain "package_for_wheels")
+ parser.add_argument(
+ "--build-dir", type=str, default=None,
+ help="The directory where PySide was build (must contain a "
+ "'package_for_wheels' folder"
+ )
options = parser.parse_args()
build_directory = get_build_directory(options)