Skip to content

Commit

Permalink
Follow up fix for 'selenium' version bump.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=262669
rdar://116428857

Reviewed by Jonathan Bedard.

This change fixes two bugs in order to use 'selenium==4.12.0'.
First issue is that newer version of selenium need to be installed with 'wheel=True'.
Second issue is autoinstalled uses ZipFile module to extract zipfile which does not
preserve file 'x' permissions. Add code to preserve the file 'x' permission during
zip and tar file extractions.

* Tools/Scripts/libraries/resultsdbpy/resultsdbpy/__init__.py:
* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
(Package.Archive.unpack):
* Tools/Scripts/webkitpy/__init__.py:

Canonical link: https://commits.webkit.org/268900@main
  • Loading branch information
dewei-zhu committed Oct 5, 2023
1 parent bcd78ce commit e984700
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _maybe_add_webkit_python_library_paths():
if sys.version_info < (3, 8):
AutoInstall.register(Package('selenium', Version(3, 141, 0)))
else:
AutoInstall.register(Package('selenium', Version(4, 12, 0)))
AutoInstall.register(Package('selenium', Version(4, 12, 0), wheel=True))
AutoInstall.register(Package('service_identity', Version(21, 1, 0), pypi_name='service-identity'))
AutoInstall.register(Package('sortedcontainers', Version(2, 4, 0)))
AutoInstall.register(Package('tornado', Version(4, 5, 3)))
Expand Down
10 changes: 7 additions & 3 deletions Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,20 @@ def unpack(self, target):
file = tarfile.open(self.path)
# Prevent write-protected files which can't be overwritten by manually setting permissions
for tarred in file:
tarred.mode = 0o777 if tarred.isdir() else 0o644
tarred.mode = 0o777 if tarred.isdir() else (0o644 | (tarred.mode & 0o111))
try:
file.extractall(target)
finally:
file.close()
elif self.extension in ['whl', 'zip']:
with zipfile.ZipFile(self.path, 'r') as file:
file.extractall(target)
for zip_info in file.infolist():
file_path = file.extract(zip_info, target)
mode = (zip_info.external_attr >> 16) & 0x1FF
mode = 0o777 if zip_info.is_dir() else (0o644 | (mode & 0o111))
os.chmod(file_path, mode)
else:
raise OSError('{} has an unrecognized package format'.format(self.path))
raise OSError('{} has an unrecognized package format'.format(self.path))

def __init__(self, import_name, version=None, pypi_name=None, slow_install=False, wheel=False, aliases=None, implicit_deps=None):
self.name = import_name
Expand Down
2 changes: 1 addition & 1 deletion Tools/Scripts/webkitpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
if sys.version_info < (3, 8):
AutoInstall.register(Package('selenium', Version(3, 141, 0)))
else:
AutoInstall.register(Package('selenium', Version(4, 12, 0)))
AutoInstall.register(Package('selenium', Version(4, 12, 0), wheel=True))

AutoInstall.register(Package('toml', Version(0, 10, 1), implicit_deps=['pyparsing']))
AutoInstall.register(Package('wcwidth', Version(0, 2, 5)))
Expand Down

0 comments on commit e984700

Please sign in to comment.