Skip to content

Support specifying a torch range #3886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ def _make_version_file(version, sha):


def _get_pytorch_version():
if "PYTORCH_VERSION" in os.environ:
return f"torch=={os.environ['PYTORCH_VERSION']}"
return "torch"
pytorch_dep = os.getenv("TORCH_PACKAGE_NAME", "torch")
if version_pin := os.getenv("PYTORCH_VERSION"):
pytorch_dep += "==" + version_pin
elif (version_pin_ge := os.getenv("PYTORCH_VERSION_GE")) and (version_pin_lt := os.getenv("PYTORCH_VERSION_LT")):
pytorch_dep += f">={version_pin_ge},<{version_pin_lt}"
return pytorch_dep


class clean(distutils.command.clean.clean):
Expand Down