From 7296e06dd5f3689e5af8638847bf6c57cf2c1a26 Mon Sep 17 00:00:00 2001 From: David Brownell <38224104+davidbrownellWork@users.noreply.github.com> Date: Wed, 29 Apr 2020 09:47:51 -0700 Subject: [PATCH] Properly creating arguments to pass to setup.py (#3744) --- setup.py | 45 ++++++++++++++++++++++------------------- tools/ci_build/build.py | 13 ++++++++---- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/setup.py b/setup.py index d0990abb95..c3c0c6ec02 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,26 @@ featurizers_build = False package_name = 'onnxruntime' wheel_name_suffix = None +# Any combination of the following arguments can be applied +if '--use_featurizers' in sys.argv: + featurizers_build = True + sys.argv.remove('--use_featurizers') + +if '--nightly_build' in sys.argv: + package_name = 'ort-nightly' + nightly_build = True + sys.argv.remove('--nightly_build') + +for arg in sys.argv[1:]: + if arg.startswith("--wheel_name_suffix="): + wheel_name_suffix = arg[len("--wheel_name_suffix="):] + nightly_build = True + + sys.argv.remove(arg) + + break + +# The following arguments are mutually exclusive if '--use_tensorrt' in sys.argv: package_name = 'onnxruntime-gpu-tensorrt' sys.argv.remove('--use_tensorrt') @@ -36,34 +56,17 @@ elif '--use_cuda' in sys.argv: elif '--use_ngraph' in sys.argv: package_name = 'onnxruntime-ngraph' sys.argv.remove('--use_ngraph') - +elif '--use_openvino' in sys.argv: + package_name = 'onnxruntime-openvino' + sys.argv.remove('--use_openvino') elif '--use_dnnl' in sys.argv: package_name = 'onnxruntime-dnnl' sys.argv.remove('--use_dnnl') elif '--use_nuphar' in sys.argv: package_name = 'onnxruntime-nuphar' sys.argv.remove('--use_nuphar') -elif '--use_openvino' in sys.argv: - package_name = 'onnxruntime-openvino' - sys.argv.remove('--use_openvino') +# --use_acl is specified in build.py, but not parsed here -elif '--use_featurizers' in sys.argv: - featurizers_build = True - sys.argv.remove('--use_featurizers') - -if '--nightly_build' in sys.argv: - package_name = 'ort-nightly' - nightly_build = True - sys.argv.remove('--nightly_build') - -for arg in sys.argv[1:]: - if arg.startswith("--wheel_name_suffix="): - wheel_name_suffix = arg[len("--wheel_name_suffix="):] - nightly_build = True - - sys.argv.remove(arg) - - break is_manylinux1 = False if environ.get('AUDITWHEEL_PLAT', None) == 'manylinux1_x86_64' or environ.get('AUDITWHEEL_PLAT', None) == 'manylinux2010_x86_64' : diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index ab88350e65..63cc9170eb 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1345,10 +1345,19 @@ def build_python_wheel( cwd = get_config_build_dir(build_dir, config) if is_windows(): cwd = os.path.join(cwd, config) + args = [sys.executable, os.path.join(source_dir, 'setup.py'), 'bdist_wheel'] + + # Any combination of the following arguments can be applied if nightly_build: args.append('--nightly_build') + if featurizers_build: + args.append("--use_featurizers") + if wheel_name_suffix: + args.append('--wheel_name_suffix={}'.format(wheel_name_suffix)) + + # The following arguments are mutually exclusive if use_tensorrt: args.append('--use_tensorrt') elif use_cuda: @@ -1361,12 +1370,8 @@ def build_python_wheel( args.append('--use_dnnl') elif use_nuphar: args.append('--use_nuphar') - if wheel_name_suffix: - args.append('--wheel_name_suffix={}'.format(wheel_name_suffix)) elif use_acl: args.append('--use_acl') - elif featurizers_build: - args.append("--use_featurizers") run_subprocess(args, cwd=cwd)