17
17
import shutil
18
18
import subprocess
19
19
import sys
20
- import typing
21
20
import zipfile
21
+ from pathlib import Path
22
22
23
23
import setuptools
24
24
from wheel .bdist_wheel import bdist_wheel as BDistWheelCommand
25
25
26
26
driver_version = "1.9.0-1614037901000"
27
27
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 :
35
29
for name in zip .namelist ():
36
30
member = zip .getinfo (name )
37
- extracted_path = zip ._extract_member (member , path , None )
31
+ extracted_path = zip .extract (member , path )
38
32
attr = member .external_attr >> 16
39
33
if attr != 0 :
40
34
os .chmod (extracted_path , attr )
@@ -88,7 +82,7 @@ def run(self) -> None:
88
82
shutil .copy (base_wheel_location , wheel_location )
89
83
with zipfile .ZipFile (wheel_location , "a" ) as zip :
90
84
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 ):
92
86
for file in files :
93
87
from_path = os .path .join (dir_path , file )
94
88
to_path = os .path .relpath (from_path , driver_root )
@@ -108,12 +102,16 @@ def run(self) -> None:
108
102
author = "Microsoft Corporation" ,
109
103
author_email = "" ,
110
104
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" ) ,
112
106
long_description_content_type = "text/markdown" ,
113
107
url = "https://github.com/Microsoft/playwright-python" ,
114
108
packages = ["playwright" ],
115
109
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
+ ],
117
115
classifiers = [
118
116
"Topic :: Software Development :: Testing" ,
119
117
"Topic :: Internet :: WWW/HTTP :: Browsers" ,
@@ -132,7 +130,7 @@ def run(self) -> None:
132
130
"write_to" : "playwright/_repo_version.py" ,
133
131
"write_to_template" : 'version = "{version}"\n ' ,
134
132
},
135
- setup_requires = ["setuptools_scm" ],
133
+ setup_requires = ["setuptools_scm" , "wheel" ],
136
134
entry_points = {
137
135
"console_scripts" : [
138
136
"playwright=playwright.__main__:main" ,
0 commit comments