Skip to content

Commit 9ebc62e

Browse files
pytorchbotoraluben
andauthored
Fix license check for setuptools>=77 (pytorch#153581)
Fix license check for setuptools>=77 (pytorch#151158) Fixes pytorch#151157 See issue for more information Pull Request resolved: pytorch#151158 Approved by: https://github.com/malfet (cherry picked from commit 5b16a07) Co-authored-by: Yichen Yan <[email protected]>
1 parent 378a55c commit 9ebc62e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/test_license.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ def test_distinfo_license(self):
4545
'Found too many "torch-*dist-info" directories '
4646
f'in "{site_packages}, expected only one'
4747
)
48-
with open(os.path.join(os.path.join(distinfo[0], "LICENSE"))) as fid:
48+
# setuptools renamed *dist-info/LICENSE to *dist-info/licenses/LICENSE sicne 77.0
49+
license_file = os.path.join(distinfo[0], "licenses", "LICENSE")
50+
if not os.path.exists(license_file):
51+
license_file = os.path.join(distinfo[0], "LICENSE")
52+
with open(license_file) as fid:
4953
txt = fid.read()
5054
self.assertTrue(starting_txt in txt)
5155

0 commit comments

Comments
 (0)