diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-07-27 17:26:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 15:26:22 +0000 |
commit | 17a5b9200d09e50850155c71919b99bf8e322798 (patch) | |
tree | a0c7bc2a8ec08087d063d7a8a8a6adb1a55d2e5a /python | |
parent | b8c04b4bad1636f78cddf8ec1944386520600da0 (diff) | |
download | servo-17a5b9200d09e50850155c71919b99bf8e322798.tar.gz servo-17a5b9200d09e50850155c71919b99bf8e322798.zip |
Remove old code for out-of-date CA stores (#30031)
This code was written to handle both Python 2 (which we no longer
support) and old Windows CI machines that did not have up-to-date CA
stores. I think we can remove this now.
Diffstat (limited to 'python')
-rw-r--r-- | python/requirements.txt | 5 | ||||
-rw-r--r-- | python/servo/devenv_commands.py | 5 | ||||
-rw-r--r-- | python/servo/util.py | 23 |
3 files changed, 3 insertions, 30 deletions
diff --git a/python/requirements.txt b/python/requirements.txt index bf7ebca1ad8..662ae2b652d 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -25,11 +25,6 @@ colorama == 0.3.7 boto3 == 1.26.127 PyGithub == 1.58.1 -# Default root CAs on Windows CI do not trust CloudFront certificates, -# connecting to https://static.rust-lang.org would fail: -# https://github.com/servo/servo/pull/18942 -certifi - # For Python3 compatibility six == 1.15 diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 065afed2a45..b09086a8ed4 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -23,7 +23,6 @@ from mach.decorators import ( ) from servo.command_base import CommandBase, cd, call -from servo.util import get_static_rust_lang_org_dist, get_urlopen_kwargs @CommandProvider @@ -172,8 +171,8 @@ class MachCommands(CommandBase): description='Update the Rust version to latest Nightly', category='devenv') def rustup(self): - url = get_static_rust_lang_org_dist() + "/channel-rust-nightly-date.txt" - nightly_date = urllib.request.urlopen(url, **get_urlopen_kwargs()).read() + nightly_date = urllib.request.urlopen( + "https://static.rust-lang.org/dist/channel-rust-nightly-date.txt").read() toolchain = b"nightly-" + nightly_date filename = path.join(self.context.topdir, "rust-toolchain") with open(filename, "wb") as f: diff --git a/python/servo/util.py b/python/servo/util.py index 43769e181de..fb1efcf382d 100644 --- a/python/servo/util.py +++ b/python/servo/util.py @@ -25,29 +25,8 @@ import six from io import BufferedIOBase, BytesIO from socket import error as socket_error -try: - from ssl import HAS_SNI -except ImportError: - HAS_SNI = False - SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..")) -HAS_SNI_AND_RECENT_PYTHON = HAS_SNI and sys.version_info >= (2, 7, 9) - - -def get_static_rust_lang_org_dist(): - if HAS_SNI_AND_RECENT_PYTHON: - return "https://static.rust-lang.org/dist" - - return "https://static-rust-lang-org.s3.amazonaws.com/dist" - - -def get_urlopen_kwargs(): - # The cafile parameter was added in 2.7.9 - if HAS_SNI_AND_RECENT_PYTHON: - import certifi - return {"cafile": certifi.where()} - return {} def remove_readonly(func, path, _): @@ -74,7 +53,7 @@ def download(description: str, url: str, writer: BufferedIOBase, start_byte: int req = urllib.request.Request(url) if start_byte: req = urllib.request.Request(url, headers={'Range': 'bytes={}-'.format(start_byte)}) - resp = urllib.request.urlopen(req, **get_urlopen_kwargs()) + resp = urllib.request.urlopen(req) fsize = None if resp.info().get('Content-Length'): |