Title: [251478] trunk/Tools
Revision
251478
Author
[email protected]
Date
2019-10-23 08:42:56 -0700 (Wed, 23 Oct 2019)

Log Message

Python 3: 2to3 script may not be in a user's path
https://bugs.webkit.org/show_bug.cgi?id=203213

Reviewed by Dewei Zhu.

* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook.__init__): Remove executive dependencies.
(AutoinstallImportHook._install_beautifulsoup): Use multiprocess because 2to3 sets
Some undesirable global logging state.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (251477 => 251478)


--- trunk/Tools/ChangeLog	2019-10-23 07:56:35 UTC (rev 251477)
+++ trunk/Tools/ChangeLog	2019-10-23 15:42:56 UTC (rev 251478)
@@ -1,3 +1,15 @@
+2019-10-23  Jonathan Bedard  <[email protected]>
+
+        Python 3: 2to3 script may not be in a user's path
+        https://bugs.webkit.org/show_bug.cgi?id=203213
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/webkitpy/thirdparty/__init__.py:
+        (AutoinstallImportHook.__init__): Remove executive dependencies.
+        (AutoinstallImportHook._install_beautifulsoup): Use multiprocess because 2to3 sets
+        Some undesirable global logging state.
+
 2019-10-23  Tim Horton  <[email protected]>
 
         prepare-ChangeLog should whine about not having tests in WebKit-only patches

Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py (251477 => 251478)


--- trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py	2019-10-23 07:56:35 UTC (rev 251477)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py	2019-10-23 15:42:56 UTC (rev 251478)
@@ -42,7 +42,6 @@
 from distutils import spawn
 from webkitpy.common.system.autoinstall import AutoInstaller
 from webkitpy.common.system.filesystem import FileSystem
-from webkitpy.common.system.executive import Executive
 
 _THIRDPARTY_DIR = os.path.dirname(__file__)
 _AUTOINSTALLED_DIR = os.path.join(_THIRDPARTY_DIR, "autoinstalled")
@@ -78,9 +77,8 @@
 
 
 class AutoinstallImportHook(object):
-    def __init__(self, filesystem=None, executive=None):
+    def __init__(self, filesystem=None):
         self._fs = filesystem or FileSystem()
-        self._executive = executive or Executive()
 
     def _ensure_autoinstalled_dir_is_in_sys_path(self):
         # Some packages require that the are being put somewhere under a directory in sys.path.
@@ -218,9 +216,18 @@
         did_download_bs4 = self._install("https://files.pythonhosted.org/packages/86/cd/495c68f0536dcd25f016e006731ba7be72e072280305ec52590012c1e6f2/beautifulsoup4-4.8.1.tar.gz",
                                          "beautifulsoup4-4.8.1/bs4")
         if did_download_bs4:
-            self._executive.run_command(['2to3', '-w', self._fs.join(_AUTOINSTALLED_DIR, 'bs4')])
+            from multiprocessing import Process
+            from lib2to3.main import main
 
+            try:
+                sys.stdout = open(os.devnull, 'w')
+                process = Process(target=main, args=('lib2to3.fixes', ['-w', self._fs.join(_AUTOINSTALLED_DIR, 'bs4')]))
+                process.start()
+                process.join()
+            finally:
+                sys.stdout = sys.__stdout__
 
+
     def _install_pylint(self):
         self._ensure_autoinstalled_dir_is_in_sys_path()
         if (not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "pylint")) or
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to