Skip to content

Commit 4da0807

Browse files
committed
Merge branch 'windows-module-pyenv' into release
2 parents 12d2205 + 0348b6c commit 4da0807

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/windows_build_module_wheels.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from subprocess import check_call
22
import os
33
import sys
4+
import argparse
45

56
SCRIPT_DIR = os.path.dirname(__file__)
67
ROOT_DIR = os.path.abspath(os.getcwd())
@@ -14,7 +15,7 @@
1415
from wheel_builder_utils import push_dir, push_env
1516
from windows_build_common import DEFAULT_PY_ENVS, venv_paths
1617

17-
def build_wheels(py_envs=DEFAULT_PY_ENVS):
18+
def build_wheels(py_envs=DEFAULT_PY_ENVS, cleanup=True, cmake_options=[]):
1819
for py_env in py_envs:
1920
python_executable, \
2021
python_include_dir, \
@@ -53,9 +54,17 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS):
5354
"-DPython3_INCLUDE_DIR:PATH=%s" % python_include_dir,
5455
"-DPython3_INCLUDE_DIRS:PATH=%s" % python_include_dir,
5556
"-DPython3_LIBRARY:FILEPATH=%s" % python_library
56-
])
57+
] + cmake_options)
5758
# Cleanup
58-
check_call([python_executable, "setup.py", "clean"])
59+
if cleanup:
60+
check_call([python_executable, "setup.py", "clean"])
5961

6062
if __name__ == '__main__':
61-
build_wheels()
63+
parser = argparse.ArgumentParser(description='Driver script to build ITK Python module wheels.')
64+
parser.add_argument('--py-envs', nargs='+', default=DEFAULT_PY_ENVS,
65+
help='Target Python environment versions, e.g. "37-x64".')
66+
parser.add_argument('--no-cleanup', dest='cleanup', action='store_false', help='Do not clean up temporary build files.')
67+
parser.add_argument('cmake_options', nargs='*', help='Extra options to pass to CMake, e.g. -DBUILD_SHARED_LIBS:BOOL=OFF')
68+
args = parser.parse_args()
69+
70+
build_wheels(cleanup=args.cleanup, py_envs=args.py_envs, cmake_options=args.cmake_options)

0 commit comments

Comments
 (0)