Skip to content

Commit 7b2addf

Browse files
oralubenNicolasHug
andauthored
Support specifying a torch range (#8936)
Co-authored-by: Nicolas Hug <[email protected]> Co-authored-by: Nicolas Hug <[email protected]>
1 parent d28001e commit 7b2addf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

setup.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,14 @@ def get_dist(pkgname):
9696
return None
9797

9898
pytorch_dep = os.getenv("TORCH_PACKAGE_NAME", "torch")
99-
if os.getenv("PYTORCH_VERSION"):
100-
pytorch_dep += "==" + os.getenv("PYTORCH_VERSION")
99+
if version_pin := os.getenv("PYTORCH_VERSION"):
100+
pytorch_dep += "==" + version_pin
101+
elif (version_pin_ge := os.getenv("PYTORCH_VERSION_GE")) and (version_pin_lt := os.getenv("PYTORCH_VERSION_LT")):
102+
# This branch and the associated env vars exist to help third-party
103+
# builds like in https://github.com/pytorch/vision/pull/8936. This is
104+
# supported on a best-effort basis, we don't guarantee that this won't
105+
# eventually break (and we don't test it.)
106+
pytorch_dep += f">={version_pin_ge},<{version_pin_lt}"
101107

102108
requirements = [
103109
"numpy",

0 commit comments

Comments
 (0)