1717import shutil
1818import subprocess
1919import sys
20- import typing
2120import zipfile
21+ from pathlib import Path
2222
2323import setuptools
2424from wheel .bdist_wheel import bdist_wheel as BDistWheelCommand
2525
2626driver_version = "1.9.0-1614037901000"
2727
28- with open ("README.md" , "r" , encoding = "utf-8" ) as fh :
29- long_description = fh .read ()
30-
31- NoneType = type (None )
32-
33-
34- def extractall (zip : typing .Any , path : str ) -> NoneType :
28+ def extractall (zip : zipfile .ZipFile , path : str ) -> None :
3529 for name in zip .namelist ():
3630 member = zip .getinfo (name )
37- extracted_path = zip ._extract_member (member , path , None )
31+ extracted_path = zip .extract (member , path )
3832 attr = member .external_attr >> 16
3933 if attr != 0 :
4034 os .chmod (extracted_path , attr )
@@ -88,7 +82,7 @@ def run(self) -> None:
8882 shutil .copy (base_wheel_location , wheel_location )
8983 with zipfile .ZipFile (wheel_location , "a" ) as zip :
9084 driver_root = os .path .abspath (f"driver/{ platform } " )
91- for dir_path , dirs , files in os .walk (driver_root ):
85+ for dir_path , _ , files in os .walk (driver_root ):
9286 for file in files :
9387 from_path = os .path .join (dir_path , file )
9488 to_path = os .path .relpath (from_path , driver_root )
@@ -108,12 +102,16 @@ def run(self) -> None:
108102 author = "Microsoft Corporation" ,
109103 author_email = "" ,
110104 description = "A high-level API to automate web browsers" ,
111- long_description = long_description ,
105+ long_description = Path ( "README.md" ). read_text ( encoding = "utf-8" ) ,
112106 long_description_content_type = "text/markdown" ,
113107 url = "https://github.com/Microsoft/playwright-python" ,
114108 packages = ["playwright" ],
115109 include_package_data = True ,
116- install_requires = ["greenlet==1.0.0" , "pyee>=8.0.1" , "typing-extensions" ],
110+ install_requires = [
111+ "greenlet==1.0.0" ,
112+ "pyee>=8.0.1" ,
113+ "typing-extensions;python_version<='3.8'" ,
114+ ],
117115 classifiers = [
118116 "Topic :: Software Development :: Testing" ,
119117 "Topic :: Internet :: WWW/HTTP :: Browsers" ,
@@ -132,7 +130,7 @@ def run(self) -> None:
132130 "write_to" : "playwright/_repo_version.py" ,
133131 "write_to_template" : 'version = "{version}"\n ' ,
134132 },
135- setup_requires = ["setuptools_scm" ],
133+ setup_requires = ["setuptools_scm" , "wheel" ],
136134 entry_points = {
137135 "console_scripts" : [
138136 "playwright=playwright.__main__:main" ,
0 commit comments