diff --git a/setup.py b/setup.py index 13808a0190ca2..d194f036581f5 100644 --- a/setup.py +++ b/setup.py @@ -518,17 +518,25 @@ def finalize_options(self): # To support the package consisting of both openvino and training modules part of it package_name = "onnxruntime-training" - # we want put default training packages to pypi. pypi does not accept package with a local version. - if not default_training_package_device or nightly_build: - if cuda_version: - # removing '.' to make Cuda version number in the same form as Pytorch. - local_version = "+cu" + cuda_version.replace(".", "") - elif rocm_version: - # removing '.' to make Rocm version number in the same form as Pytorch. - local_version = "+rocm" + rocm_version.replace(".", "") - else: - # cpu version for documentation - local_version = "+cpu" + disable_local_version = environ.get("ORT_DISABLE_PYTHON_PACKAGE_LOCAL_VERSION", "0") + disable_local_version = ( + disable_local_version == "1" + or disable_local_version.lower() == "true" + or disable_local_version.lower() == "yes" + ) + # local version should be disabled for internal feeds. + if not disable_local_version: + # we want put default training packages to pypi. pypi does not accept package with a local version. + if not default_training_package_device or nightly_build: + if cuda_version: + # removing '.' to make Cuda version number in the same form as Pytorch. + local_version = "+cu" + cuda_version.replace(".", "") + elif rocm_version: + # removing '.' to make Rocm version number in the same form as Pytorch. + local_version = "+rocm" + rocm_version.replace(".", "") + else: + # cpu version for documentation + local_version = "+cpu" if package_name == "onnxruntime-nuphar": packages += ["onnxruntime.nuphar"]