Title: [233494] trunk/Tools
Revision
233494
Author
[email protected]
Date
2018-07-03 20:14:42 -0700 (Tue, 03 Jul 2018)

Log Message

update-webkitgtk-flatpak fails if running with python2
https://bugs.webkit.org/show_bug.cgi?id=187240

Reviewed by Michael Catanzaro.

urllib.urlretrieve of Python2 sends invalid requests. Use
urllib2.urlopen instead.

* flatpak/flatpakutils.py: Import urllib2.urlopen for Python2,
urllib.request.urlopen for Python3.
(FlatpakRepo.repo_file): Copy the content of urlopen result to the
temporary file.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (233493 => 233494)


--- trunk/Tools/ChangeLog	2018-07-04 02:33:07 UTC (rev 233493)
+++ trunk/Tools/ChangeLog	2018-07-04 03:14:42 UTC (rev 233494)
@@ -1,3 +1,18 @@
+2018-07-03  Fujii Hironori  <[email protected]>
+
+        update-webkitgtk-flatpak fails if running with python2
+        https://bugs.webkit.org/show_bug.cgi?id=187240
+
+        Reviewed by Michael Catanzaro.
+
+        urllib.urlretrieve of Python2 sends invalid requests. Use
+        urllib2.urlopen instead.
+
+        * flatpak/flatpakutils.py: Import urllib2.urlopen for Python2,
+        urllib.request.urlopen for Python3.
+        (FlatpakRepo.repo_file): Copy the content of urlopen result to the
+        temporary file.
+
 2018-07-03  Chris Dumez  <[email protected]>
 
         Make CallbackMap::invalidate() safe to re-enter

Modified: trunk/Tools/flatpak/flatpakutils.py (233493 => 233494)


--- trunk/Tools/flatpak/flatpakutils.py	2018-07-04 02:33:07 UTC (rev 233493)
+++ trunk/Tools/flatpak/flatpakutils.py	2018-07-04 03:14:42 UTC (rev 233494)
@@ -38,9 +38,9 @@
     from urlparse import urlparse
 
 try:
-    from urllib.request import urlretrieve  # pylint: disable=E0611
+    from urllib.request import urlopen  # pylint: disable=E0611
 except ImportError:
-    from urllib import urlretrieve
+    from urllib2 import urlopen
 
 FLATPAK_REQ = [
     ("flatpak", "0.10.0"),
@@ -374,8 +374,9 @@
             return self._repo_file
 
         assert self.repo_file_name
-        self._repo_file = tempfile.NamedTemporaryFile(mode="w")
-        urlretrieve(self.repo_file_name, self._repo_file.name)
+        self._repo_file = tempfile.NamedTemporaryFile(mode="wb")
+        self._repo_file.write(urlopen(self.repo_file_name).read())
+        self._repo_file.flush()
 
         return self._repo_file
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to