Skip to content

Commit

Permalink
Version 3.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
adferrand committed Nov 3, 2020
1 parent 05b6029 commit 58d506d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## master - CURRENT

## 3.7.2 - 03/11/2020
### Added
* Add Python 3.9 official support

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "dnsrobocert"
version = "3.7.1"
version = "3.7.2"
description = "A tool to manage your DNS-challenged TLS certificates"
license = "MIT"
keywords = [
Expand Down
63 changes: 51 additions & 12 deletions utils/precompile_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@
BUILD_JSON = os.path.join(WHEELS_DIR, "build.json")

TARGETS = ["cryptography", "cffi", "lxml"]
ARCHS = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x"]
ARCHS = [
"linux/amd64",
"linux/386",
"linux/arm64",
"linux/arm/v7",
"linux/arm/v6",
"linux/ppc64le",
"linux/s390x",
]
PYTHON_VERSION = "3.8"
ALPINE_VERSION = "3.12"

Expand Down Expand Up @@ -50,14 +58,16 @@ def _need_rebuild(requirements):


def _extract_req(requirement):
match = re.match(r'^(.*)==(.*?)(?:$|;\w*.*$)', 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)
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):
Expand All @@ -77,26 +87,55 @@ def main():
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",
"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])
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)

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]
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,
"packages": {package: version for package, version in extracted_requirements}
"packages": {
package: version for package, version in extracted_requirements
},
}

with open(BUILD_JSON, "w") as file_h:
Expand Down

0 comments on commit 58d506d

Please sign in to comment.