[Webkit-unassigned] [Bug 137338] Remove workarounds for versions of Python before 2.7

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 8 02:29:02 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=137338





--- Comment #13 from Csaba Osztrogonác <ossy at webkit.org>  2014-10-08 02:28:58 PST ---
(From update of attachment 239203)
View in context: https://bugs.webkit.org/attachment.cgi?id=239203&action=review

> Tools/Scripts/webkitpy/common/system/autoinstall.py:-248
> -    # This is a replacement for ZipFile.extractall(), which is
> -    # available in Python 2.6 but not in earlier versions.
> -    # NOTE: The version in 2.6.1 (which shipped on Snow Leopard) is broken!
> -    def _extract_all(self, zip_file, target_dir):
> -        for name in zip_file.namelist():
> -            path = os.path.join(target_dir, name)
> -            if not os.path.basename(path):
> -                # Then the path ends in a slash, so it is a directory.
> -                os.makedirs(path)
> -                continue
> -
> -            try:
> -                # We open this file w/o encoding, as we're reading/writing
> -                # the raw byte-stream from the zip file.
> -                outfile = open(path, 'wb')
> -            except IOError:
> -                # Not all zip files seem to list the directories explicitly,
> -                # so try again after creating the containing directory.
> -                _log.debug("Got IOError: retrying after creating directory...")
> -                dirname = os.path.dirname(path)
> -                os.makedirs(dirname)
> -                outfile = open(path, 'wb')
> -
> -            try:
> -                outfile.write(zip_file.read(name))
> -            finally:
> -                outfile.close()
> -

Unfortunately it broke autoinstalling python-irclib-0.4.8.zip with the stock python on 
- Ubuntu 12.04: python 2.7.3
- Ubuntu 14.04: python 2.7.6
- OS X 10.9: python 2.7.5

I think we should add this workaround back with proper comment.

> Tools/Scripts/webkitpy/common/system/autoinstall.py:235
> -            self._extract_all(zip_file, scratch_dir)
> +            zip_file.extractall(zip_file, scratch_dir)

extractall raises the following exception:

Auto-installing package: irclib.py
Traceback (most recent call last):
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/test/main.py", line 234, in <module>
    sys.exit(main())
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/test/main.py", line 72, in main
    return not tester.run()
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/test/main.py", line 122, in run
    return self._run_tests(names)
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/test/main.py", line 132, in _run_tests
    autoinstall_everything()
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/thirdparty/__init__.py", line 166, in autoinstall_everything
    getattr(_hook, method)()
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/thirdparty/__init__.py", line 150, in _install_irc
    url_subpath="irclib.py")
  File "/Users/oszi/WebKit/Tools/Scripts/webkitpy/common/system/autoinstall.py", line 473, in install
    raise Exception(message)
Exception: Error auto-installing the irclib.py package to:
 "/Users/oszi/WebKit/Tools/Scripts/webkitpy/thirdparty/autoinstalled/irc/irclib.py"
 --> Inner message: "There is no item named '/' in the archive"

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list