Skip to content

Commit ee87c5b

Browse files
committed
bug: fix semver comparison logic using packaging.version.Version
1 parent 0ec4969 commit ee87c5b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import glob
99

1010
from setuptools import find_packages, setup
11+
from packaging.version import Version
1112

1213
from torch.utils.cpp_extension import (
1314
CppExtension,
@@ -18,10 +19,7 @@
1819

1920
library_name = "extension_cpp"
2021

21-
if torch.__version__ >= "2.6.0":
22-
py_limited_api = True
23-
else:
24-
py_limited_api = False
22+
py_limited_api = Version(torch.__version__) >= Version("2.6.0")
2523

2624

2725
def get_extensions():

0 commit comments

Comments
 (0)