From 9e09e44bd6a167778c5645ea14c55ea26beb0e57 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Sun, 14 Nov 2021 10:07:19 +0100 Subject: [PATCH] Remove pre compile wheels --- utils/precompile_wheels.py | 160 ------------------ wheels/build.json | 1 - .../cffi-1.14.5-cp39-cp39-linux_aarch64.whl | 3 - wheels/cffi-1.14.5-cp39-cp39-linux_armv7l.whl | 3 - .../cffi-1.14.5-cp39-cp39-linux_ppc64le.whl | 3 - wheels/cffi-1.14.5-cp39-cp39-linux_x86_64.whl | 3 - ...tography-3.4.7-cp39-cp39-linux_aarch64.whl | 3 - ...ptography-3.4.7-cp39-cp39-linux_armv7l.whl | 3 - ...tography-3.4.7-cp39-cp39-linux_ppc64le.whl | 3 - ...ptography-3.4.7-cp39-cp39-linux_x86_64.whl | 3 - wheels/lxml-4.6.3-cp39-cp39-linux_aarch64.whl | 3 - wheels/lxml-4.6.3-cp39-cp39-linux_armv7l.whl | 3 - wheels/lxml-4.6.3-cp39-cp39-linux_ppc64le.whl | 3 - wheels/lxml-4.6.3-cp39-cp39-linux_x86_64.whl | 3 - 14 files changed, 197 deletions(-) delete mode 100755 utils/precompile_wheels.py delete mode 100644 wheels/build.json delete mode 100644 wheels/cffi-1.14.5-cp39-cp39-linux_aarch64.whl delete mode 100644 wheels/cffi-1.14.5-cp39-cp39-linux_armv7l.whl delete mode 100644 wheels/cffi-1.14.5-cp39-cp39-linux_ppc64le.whl delete mode 100644 wheels/cffi-1.14.5-cp39-cp39-linux_x86_64.whl delete mode 100644 wheels/cryptography-3.4.7-cp39-cp39-linux_aarch64.whl delete mode 100644 wheels/cryptography-3.4.7-cp39-cp39-linux_armv7l.whl delete mode 100644 wheels/cryptography-3.4.7-cp39-cp39-linux_ppc64le.whl delete mode 100644 wheels/cryptography-3.4.7-cp39-cp39-linux_x86_64.whl delete mode 100644 wheels/lxml-4.6.3-cp39-cp39-linux_aarch64.whl delete mode 100644 wheels/lxml-4.6.3-cp39-cp39-linux_armv7l.whl delete mode 100644 wheels/lxml-4.6.3-cp39-cp39-linux_ppc64le.whl delete mode 100644 wheels/lxml-4.6.3-cp39-cp39-linux_x86_64.whl diff --git a/utils/precompile_wheels.py b/utils/precompile_wheels.py deleted file mode 100755 index 6a4969d8..00000000 --- a/utils/precompile_wheels.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python3 -import json -import os -import re -import shutil -import subprocess -import tempfile - -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -WHEELS_DIR = os.path.join(ROOT_DIR, "wheels") -BUILD_JSON = os.path.join(WHEELS_DIR, "build.json") - -TARGETS = ["cryptography", "cffi", "lxml"] -ARCHS = [ - "linux/amd64", - "linux/arm64", - "linux/arm/v7", - "linux/ppc64le", -] -PYTHON_VERSION = "3.9" -ALPINE_VERSION = "3.13" - -# We need to set CRYPTOGRAPHY_DONT_BUILD_RUST for now because Rust is not working properly -# for emulated 32 bits architecture with QEMU (eg. armv7) on 64 bits architecture (eg. amd64). -# See https://github.com/docker/buildx/issues/395 -DOCKERFILE = f""" -FROM docker.io/python:{PYTHON_VERSION}-alpine{ALPINE_VERSION} - -RUN apk --no-cache add \ - build-base \ - openssl-dev \ - libxml2-dev \ - libxslt-dev \ - libffi-dev \ - zlib-dev \ - cargo - -COPY requirements.txt . - -ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 - -RUN python -m pip wheel --no-binary :all: --no-deps -r requirements.txt -w /precompiled-wheels - -CMD ["cp", "-ra", "/precompiled-wheels", "/wheels"] -""" - - -def _need_rebuild(requirements): - if not os.path.exists(BUILD_JSON): - return True - - with open(BUILD_JSON) as file_h: - descriptor = json.loads(file_h.read()) - - if descriptor.get("python_version") != PYTHON_VERSION: - return True - - if descriptor.get("alpine_version") != ALPINE_VERSION: - return True - - if descriptor.get("architectures") != ARCHS: - return True - - for requirement in requirements: - package, version = _extract_req(requirement) - if descriptor.get("packages").get(package) != version: - return True - - return False - - -def _extract_req(requirement): - match = re.match(r"^(.*)==(.*?)(?:$|;\w*.*$)", requirement) - return match.group(1), match.group(2) - - -def main(): - with tempfile.TemporaryDirectory() as workspace: - output = subprocess.check_output( - ["poetry", "export", "--format", "requirements.txt", "--without-hashes"], - universal_newlines=True, - ) - requirements = [] - for entry in output.split("\n"): - if re.match(rf"^({'|'.join(TARGETS)}).*$", entry): - requirements.append(entry) - - if _need_rebuild(requirements): - print("Wheels are out-of-date and need to be rebuilt.") - else: - print("Wheels are up-to-date, no rebuild is needed.") - return - - requirements_path = os.path.join(workspace, "requirements.txt") - with open(requirements_path, "w+") as file_h: - for requirement in requirements: - print(requirement, file=file_h) - - with open(os.path.join(workspace, "Dockerfile"), "w") as file_h: - file_h.write(DOCKERFILE) - - subprocess.check_call( - [ - "docker", - "run", - "--rm", - "--privileged", - "docker.io/multiarch/qemu-user-static", - "--reset", - "-p", - "yes", - ] - ) - - subprocess.check_call(["docker", "buildx", "create", "--use"]) - - subprocess.check_call( - [ - "docker", - "buildx", - "build", - "--platform", - ",".join(ARCHS), - f"--output=type=local,dest={workspace}", - "--tag", - "dnsrobocert-wheels", - workspace, - ] - ) - - if os.path.exists(WHEELS_DIR): - shutil.rmtree(WHEELS_DIR) - os.makedirs(WHEELS_DIR, exist_ok=True) - - for arch in ARCHS: - arch = arch.replace("/", "_") - shutil.copytree( - os.path.join(workspace, arch, "precompiled-wheels"), - WHEELS_DIR, - dirs_exist_ok=True, - ) - - extracted_requirements = [ - _extract_req(requirement) for requirement in requirements - ] - build_data = { - "python_version": PYTHON_VERSION, - "alpine_version": ALPINE_VERSION, - "architectures": ARCHS, - "packages": { - package: version for package, version in extracted_requirements - }, - } - - with open(BUILD_JSON, "w") as file_h: - file_h.write(json.dumps(build_data)) - - -if __name__ == "__main__": - main() diff --git a/wheels/build.json b/wheels/build.json deleted file mode 100644 index a54c8012..00000000 --- a/wheels/build.json +++ /dev/null @@ -1 +0,0 @@ -{"python_version": "3.9", "alpine_version": "3.13", "architectures": ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le"], "packages": {"cffi": "1.14.5", "cryptography": "3.4.7", "lxml": "4.6.3"}} \ No newline at end of file diff --git a/wheels/cffi-1.14.5-cp39-cp39-linux_aarch64.whl b/wheels/cffi-1.14.5-cp39-cp39-linux_aarch64.whl deleted file mode 100644 index d01959e6..00000000 --- a/wheels/cffi-1.14.5-cp39-cp39-linux_aarch64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:81d5dae2ff4f9a387439cc8b299285ecaba717946a6713e3ad6269fffd48853b -size 188642 diff --git a/wheels/cffi-1.14.5-cp39-cp39-linux_armv7l.whl b/wheels/cffi-1.14.5-cp39-cp39-linux_armv7l.whl deleted file mode 100644 index 25c8d9c3..00000000 --- a/wheels/cffi-1.14.5-cp39-cp39-linux_armv7l.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:24771d16b382327669c24a5036bdf3a26bd34f986a29dfe1d6ea4f8a13e0be11 -size 171231 diff --git a/wheels/cffi-1.14.5-cp39-cp39-linux_ppc64le.whl b/wheels/cffi-1.14.5-cp39-cp39-linux_ppc64le.whl deleted file mode 100644 index e5ec514b..00000000 --- a/wheels/cffi-1.14.5-cp39-cp39-linux_ppc64le.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:143b5027af5fcd0d6a1003074c83ab65ccc9295f940b9415ae61026e3711f740 -size 197270 diff --git a/wheels/cffi-1.14.5-cp39-cp39-linux_x86_64.whl b/wheels/cffi-1.14.5-cp39-cp39-linux_x86_64.whl deleted file mode 100644 index 76efcfc1..00000000 --- a/wheels/cffi-1.14.5-cp39-cp39-linux_x86_64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d75eb4c985a307aac9eb84ef48126df3f94bc0d80c9e5b76f12fe8838755f8af -size 185811 diff --git a/wheels/cryptography-3.4.7-cp39-cp39-linux_aarch64.whl b/wheels/cryptography-3.4.7-cp39-cp39-linux_aarch64.whl deleted file mode 100644 index fbf298d4..00000000 --- a/wheels/cryptography-3.4.7-cp39-cp39-linux_aarch64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0d0cc04877ae48ce22299aeb891afd8e9be90936f528a1f83edf3a482e708d00 -size 341416 diff --git a/wheels/cryptography-3.4.7-cp39-cp39-linux_armv7l.whl b/wheels/cryptography-3.4.7-cp39-cp39-linux_armv7l.whl deleted file mode 100644 index f8c27729..00000000 --- a/wheels/cryptography-3.4.7-cp39-cp39-linux_armv7l.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e315d869f3097781079ddbfc97108f6acefc4918743537f80455d5dcd1383b60 -size 328995 diff --git a/wheels/cryptography-3.4.7-cp39-cp39-linux_ppc64le.whl b/wheels/cryptography-3.4.7-cp39-cp39-linux_ppc64le.whl deleted file mode 100644 index a4a4005a..00000000 --- a/wheels/cryptography-3.4.7-cp39-cp39-linux_ppc64le.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a140e9b427f550e6c48522585e35649df4f45045539a77d8af4ef21a764ae499 -size 353326 diff --git a/wheels/cryptography-3.4.7-cp39-cp39-linux_x86_64.whl b/wheels/cryptography-3.4.7-cp39-cp39-linux_x86_64.whl deleted file mode 100644 index 093c0173..00000000 --- a/wheels/cryptography-3.4.7-cp39-cp39-linux_x86_64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4623e05870259633aed6f050cfd1301a818664c079915a55f6c69c46f0875298 -size 366277 diff --git a/wheels/lxml-4.6.3-cp39-cp39-linux_aarch64.whl b/wheels/lxml-4.6.3-cp39-cp39-linux_aarch64.whl deleted file mode 100644 index 6580f9bc..00000000 --- a/wheels/lxml-4.6.3-cp39-cp39-linux_aarch64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:207615629602519a93052019272ce758b8ff2f34ce6ec8aaf11e7c77b8eabec0 -size 1586660 diff --git a/wheels/lxml-4.6.3-cp39-cp39-linux_armv7l.whl b/wheels/lxml-4.6.3-cp39-cp39-linux_armv7l.whl deleted file mode 100644 index 8c9b35ce..00000000 --- a/wheels/lxml-4.6.3-cp39-cp39-linux_armv7l.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0a0603ecdc54f231f2de7f4b58131fbe2efa07623b1e3294e04742dc5442f9eb -size 1506573 diff --git a/wheels/lxml-4.6.3-cp39-cp39-linux_ppc64le.whl b/wheels/lxml-4.6.3-cp39-cp39-linux_ppc64le.whl deleted file mode 100644 index b47ea251..00000000 --- a/wheels/lxml-4.6.3-cp39-cp39-linux_ppc64le.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9791123b0b124cd58f65835fc82f4e98e75ffc1a7e41c2a38696d771291ed8f2 -size 1783398 diff --git a/wheels/lxml-4.6.3-cp39-cp39-linux_x86_64.whl b/wheels/lxml-4.6.3-cp39-cp39-linux_x86_64.whl deleted file mode 100644 index ac51d40c..00000000 --- a/wheels/lxml-4.6.3-cp39-cp39-linux_x86_64.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c9f5571a6a736bfa3110c67eedc938e2388ca8f69b2a3ff0552fd0261f6115f7 -size 1668385