Title: [270378] trunk/Tools
Revision
270378
Author
[email protected]
Date
2020-12-02 16:55:40 -0800 (Wed, 02 Dec 2020)

Log Message

[webkitcorepy] Allow caller of autoinstall to specify CA file
https://bugs.webkit.org/show_bug.cgi?id=219433
<rdar://problem/71869247>

Reviewed by Dewei Zhu.

* Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
(AutoInstall):
(AutoInstall._request): Allow user to specify CA cert file.
(AutoInstall.set_index): Allow caller to specify CA cert file.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (270377 => 270378)


--- trunk/Tools/ChangeLog	2020-12-03 00:42:58 UTC (rev 270377)
+++ trunk/Tools/ChangeLog	2020-12-03 00:55:40 UTC (rev 270378)
@@ -1,3 +1,16 @@
+2020-12-02  Jonathan Bedard  <[email protected]>
+
+        [webkitcorepy] Allow caller of autoinstall to specify CA file
+        https://bugs.webkit.org/show_bug.cgi?id=219433
+        <rdar://problem/71869247>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
+        (AutoInstall):
+        (AutoInstall._request): Allow user to specify CA cert file.
+        (AutoInstall.set_index): Allow caller to specify CA cert file.
+
 2020-12-02  Tim Horton  <[email protected]>
 
         Enable UI-side compositing on the GPU Process layout tests bot

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py (270377 => 270378)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2020-12-03 00:42:58 UTC (rev 270377)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2020-12-03 00:55:40 UTC (rev 270378)
@@ -35,7 +35,7 @@
 from webkitcorepy.subprocess_utils import TimeoutExpired, CompletedProcess, run
 from webkitcorepy.output_capture import LoggerCapture, OutputCapture, OutputDuplicate
 
-version = Version(0, 4, 21)
+version = Version(0, 4, 22)
 
 from webkitcorepy.autoinstall import Package, AutoInstall
 if sys.version_info > (3, 0):

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py (270377 => 270378)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py	2020-12-03 00:42:58 UTC (rev 270377)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py	2020-12-03 00:55:40 UTC (rev 270378)
@@ -319,20 +319,16 @@
     packages = defaultdict(list)
     manifest = {}
 
+    # Rely on our own certificates for PyPi, since we use PyPi to standardize root certificates
+    ca_cert_path = os.path.join(os.path.dirname(__file__), 'cacert.pem')
+
     # When sharing an install location, projects may wish to overwrite packages on disk
     # originating from a different index.
     overwrite_foreign_packages = False
 
     @classmethod
-    def _request(cls, url):
-        # Rely on our own certificates for PyPi, since we use PyPi to standardize root certificates
-        if url.startswith('https://pypi.org') or url.startswith('https://files.pythonhosted.org'):
-            return urlopen(
-                url,
-                timeout=cls.timeout,
-                cafile=os.path.join(os.path.dirname(__file__), 'cacert.pem'),
-            )
-        return urlopen(url, timeout=cls.timeout)
+    def _request(cls, url, ca_cert_path=None):
+        return urlopen(url, timeout=cls.timeout, cafile=ca_cert_path or cls.ca_cert_path)
 
     @classmethod
     def enabled(cls):
@@ -399,9 +395,10 @@
         cls.directory = directory
 
     @classmethod
-    def set_index(cls, index, check=True, fatal=False):
+    def set_index(cls, index, check=True, fatal=False, ca_cert_path=None):
         if not check:
             cls.index = index
+            cls.ca_cert_path = ca_cert_path
             return cls.index
 
         def error(message):
@@ -413,11 +410,12 @@
 
         response = None
         try:
-            response = AutoInstall._request('https://{}/simple/pip/'.format(index))
+            response = AutoInstall._request('https://{}/simple/pip/'.format(index), ca_cert_path=ca_cert_path)
             if response.code != 200:
                 error('Failed to set AutoInstall index to {}, received {} response when searching for simple/pip'.format(index, response.code))
             else:
                 cls.index = index
+                cls.ca_cert_path = ca_cert_path
         except URLError:
             error('Failed to set AutoInstall index to {}, no response from the server'.format(index))
         finally:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to