@@ -60,61 +60,86 @@ def run(self) -> None:
60
60
if self .all :
61
61
# If building for all platforms
62
62
platform_map = {
63
- "darwin" : {
64
- "zip_name" : "mac" ,
65
- "wheels" : ["macosx_10_13_x86_64.whl" , "macosx_11_0_universal2.whl" ],
66
- },
67
- "linux" : {"zip_name" : "linux" , "wheels" : ["manylinux1_x86_64.whl" ]},
68
- "win32" : {
69
- "zip_name" : "win32_x64" ,
70
- "wheels" : ["win32.whl" , "win_amd64.whl" ],
71
- },
63
+ "darwin" : [
64
+ {
65
+ "zip_name" : "mac" ,
66
+ "wheels" : [
67
+ "macosx_10_13_x86_64.whl" ,
68
+ "macosx_11_0_universal2.whl" ,
69
+ ],
70
+ },
71
+ {
72
+ "zip_name" : "mac-arm64" ,
73
+ "wheels" : [
74
+ "macosx_11_0_arm64.whl" ,
75
+ ],
76
+ },
77
+ ],
78
+ "linux" : [
79
+ {"zip_name" : "linux" , "wheels" : ["manylinux1_x86_64.whl" ]},
80
+ {
81
+ "zip_name" : "linux-arm64" ,
82
+ "wheels" : ["manylinux_2_17_aarch64.manylinux2014_aarch64.whl" ],
83
+ },
84
+ ],
85
+ "win32" : [
86
+ {
87
+ "zip_name" : "win32_x64" ,
88
+ "wheels" : ["win32.whl" , "win_amd64.whl" ],
89
+ }
90
+ ],
72
91
}
73
92
platforms = [* platform_map .values ()]
74
93
else :
75
94
# If building for only current platform
76
95
platform_map = {
77
- "darwin" : {
78
- "zip_name" : "mac" ,
79
- "wheels" : ["macosx_10_13_x86_64.whl" ],
80
- },
81
- "linux" : {"zip_name" : "linux" , "wheels" : ["manylinux1_x86_64.whl" ]},
82
- "win32" : {
83
- "zip_name" : "win32_x64" ,
84
- "wheels" : ["win_amd64.whl" ],
85
- },
96
+ "darwin" : [
97
+ {
98
+ "zip_name" : "mac" ,
99
+ "wheels" : ["macosx_10_13_x86_64.whl" ],
100
+ },
101
+ ],
102
+ "linux" : [{"zip_name" : "linux" , "wheels" : ["manylinux1_x86_64.whl" ]}],
103
+ "win32" : [
104
+ {
105
+ "zip_name" : "win32_x64" ,
106
+ "wheels" : ["win_amd64.whl" ],
107
+ }
108
+ ],
86
109
}
87
110
platforms = [platform_map [sys .platform ]]
88
111
for platform in platforms :
89
- zip_file = f"playwright-{ driver_version } -{ platform ['zip_name' ]} .zip"
90
- if not os .path .exists ("driver/" + zip_file ):
91
- url = f"https://playwright.azureedge.net/builds/driver/next/{ zip_file } "
92
- print (f"Fetching { url } " )
93
- # Don't replace this with urllib - Python won't have certificates to do SSL on all platforms.
94
- subprocess .check_call (["curl" , url , "-o" , "driver/" + zip_file ])
112
+ for arch in platform :
113
+ zip_file = f"playwright-{ driver_version } -{ arch ['zip_name' ]} .zip"
114
+ if not os .path .exists ("driver/" + zip_file ):
115
+ url = f"https://playwright.azureedge.net/builds/driver/next/{ zip_file } "
116
+ print (f"Fetching { url } " )
117
+ # Don't replace this with urllib - Python won't have certificates to do SSL on all platforms.
118
+ subprocess .check_call (["curl" , url , "-o" , "driver/" + zip_file ])
95
119
base_wheel_location = glob .glob (os .path .join (self .dist_dir , "*.whl" ))[0 ]
96
120
without_platform = base_wheel_location [:- 7 ]
97
121
98
122
for platform in platforms :
99
- zip_file = f"driver/playwright-{ driver_version } -{ platform ['zip_name' ]} .zip"
100
- with zipfile .ZipFile (zip_file , "r" ) as zip :
101
- extractall (zip , f"driver/{ platform ['zip_name' ]} " )
102
- if platform_map [sys .platform ] in platforms :
123
+ for arch in platform :
124
+ zip_file = f"driver/playwright-{ driver_version } -{ arch ['zip_name' ]} .zip"
103
125
with zipfile .ZipFile (zip_file , "r" ) as zip :
104
- extractall (zip , "playwright/driver" )
105
- for wheel in platform ["wheels" ]:
106
- wheel_location = without_platform + wheel
107
- shutil .copy (base_wheel_location , wheel_location )
108
- with zipfile .ZipFile (wheel_location , "a" ) as zip :
109
- driver_root = os .path .abspath (f"driver/{ platform ['zip_name' ]} " )
110
- for dir_path , _ , files in os .walk (driver_root ):
111
- for file in files :
112
- from_path = os .path .join (dir_path , file )
113
- to_path = os .path .relpath (from_path , driver_root )
114
- zip .write (from_path , f"playwright/driver/{ to_path } " )
115
- zip .writestr (
116
- "playwright/driver/README.md" , f"{ wheel } driver package"
117
- )
126
+ extractall (zip , f"driver/{ arch ['zip_name' ]} " )
127
+ if platform_map [sys .platform ][0 ] in platform :
128
+ with zipfile .ZipFile (zip_file , "r" ) as zip :
129
+ extractall (zip , "playwright/driver" )
130
+ for wheel in arch ["wheels" ]:
131
+ wheel_location = without_platform + wheel
132
+ shutil .copy (base_wheel_location , wheel_location )
133
+ with zipfile .ZipFile (wheel_location , "a" ) as zip :
134
+ driver_root = os .path .abspath (f"driver/{ arch ['zip_name' ]} " )
135
+ for dir_path , _ , files in os .walk (driver_root ):
136
+ for file in files :
137
+ from_path = os .path .join (dir_path , file )
138
+ to_path = os .path .relpath (from_path , driver_root )
139
+ zip .write (from_path , f"playwright/driver/{ to_path } " )
140
+ zip .writestr (
141
+ "playwright/driver/README.md" , f"{ wheel } driver package"
142
+ )
118
143
119
144
os .remove (base_wheel_location )
120
145
if InWheel :
0 commit comments