Skip to content

Commit 9991b54

Browse files
chore(build): don't rely on auditwheel package (microsoft#645)
1 parent 734e425 commit 9991b54

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

setup.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
from pathlib import Path
2222

2323
import setuptools
24-
from auditwheel.wheeltools import InWheel
24+
25+
try:
26+
27+
from auditwheel.wheeltools import InWheel
28+
except ImportError:
29+
InWheel = None
2530
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
2631

2732
driver_version = "1.11.0-next-1618801354000"
@@ -110,17 +115,20 @@ def run(self) -> None:
110115
zip.writestr("playwright/driver/README.md", "Universal Mac package")
111116

112117
os.remove(base_wheel_location)
113-
for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):
114-
os.makedirs("wheelhouse", exist_ok=True)
115-
with InWheel(
116-
in_wheel=whlfile,
117-
out_wheel=os.path.join("wheelhouse", os.path.basename(whlfile)),
118-
ret_self=True,
119-
):
120-
print("Updating RECORD file of %s" % whlfile)
121-
shutil.rmtree(self.dist_dir)
122-
print("Copying new wheels")
123-
shutil.move("wheelhouse", self.dist_dir)
118+
if InWheel:
119+
for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):
120+
os.makedirs("wheelhouse", exist_ok=True)
121+
with InWheel(
122+
in_wheel=whlfile,
123+
out_wheel=os.path.join("wheelhouse", os.path.basename(whlfile)),
124+
ret_self=True,
125+
):
126+
print("Updating RECORD file of %s" % whlfile)
127+
shutil.rmtree(self.dist_dir)
128+
print("Copying new wheels")
129+
shutil.move("wheelhouse", self.dist_dir)
130+
else:
131+
print("auditwheel not installed, not updating RECORD file")
124132

125133

126134
setuptools.setup(

0 commit comments

Comments
 (0)