Skip to content

Commit 08ef2d4

Browse files
committed
updates
1 parent 897ae17 commit 08ef2d4

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

setup.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def run(self) -> None:
109109
},
110110
{
111111
"wheel": "win32.whl",
112-
"machine": "amd64",
112+
"machine": "i386",
113113
"platform": "win32",
114114
"zip_name": "win32_x64",
115115
},
@@ -120,20 +120,27 @@ def run(self) -> None:
120120
"zip_name": "win32_x64",
121121
},
122122
]
123-
self._install_local_driver(base_wheel_bundles)
124-
if self.all:
125-
self._install_all_wheels(base_wheel_bundles)
123+
self._download_and_extract_local_driver(base_wheel_bundles)
124+
125+
wheels = base_wheel_bundles
126+
if not self.all:
127+
wheels = list(
128+
filter(
129+
lambda wheel: wheel["platform"] == sys.platform
130+
and wheel["machine"] == platform.machine().lower(),
131+
base_wheel_bundles,
132+
)
133+
)
134+
self._build_wheels(wheels)
126135

127-
def _install_all_wheels(
136+
def _build_wheels(
128137
self,
129138
wheels: List[Dict[str, str]],
130139
) -> None:
131-
for wheel_bundle in wheels:
132-
download_driver(wheel_bundle["zip_name"])
133140
base_wheel_location: str = glob.glob(os.path.join(self.dist_dir, "*.whl"))[0]
134141
without_platform = base_wheel_location[:-7]
135-
136142
for wheel_bundle in wheels:
143+
download_driver(wheel_bundle["zip_name"])
137144
zip_file = (
138145
f"driver/playwright-{driver_version}-{wheel_bundle['zip_name']}.zip"
139146
)
@@ -152,7 +159,6 @@ def _install_all_wheels(
152159
"playwright/driver/README.md",
153160
f"{wheel_bundle['wheel']} driver package",
154161
)
155-
156162
os.remove(base_wheel_location)
157163
if InWheel:
158164
for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):
@@ -168,15 +174,15 @@ def _install_all_wheels(
168174
else:
169175
print("auditwheel not installed, not updating RECORD file")
170176

171-
def _install_local_driver(
177+
def _download_and_extract_local_driver(
172178
self,
173179
wheels: List[Dict[str, str]],
174180
) -> None:
175181
zip_names_for_current_system = set(
176182
map(
177183
lambda wheel: wheel["zip_name"],
178184
filter(
179-
lambda wheel: wheel["machine"] == platform.machine()
185+
lambda wheel: wheel["machine"] == platform.machine().lower()
180186
and wheel["platform"] == sys.platform,
181187
wheels,
182188
),

0 commit comments

Comments
 (0)