Skip to content

Commit

Permalink
use branch as CLI argument
Browse files Browse the repository at this point in the history
  • Loading branch information
quarckster committed Jul 12, 2024
1 parent b266a0d commit 1a6ca1e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import os
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path


def get_branch(version: str) -> str:
if version in ["1.0.2", "1.1.1"]:
return f"OpenSSL_{version.replace('.', '_')}-stable"
if version == "master":
def get_version_from_branch(branch: str) -> str:
if branch == "master":
return "master"
return f"openssl-{version}"
if match := re.match(r"openssl-(3\.[0-9]+)", branch):
return match.group(1)
if branch == "OpenSSL_1_1_1-stable":
return "1.1.1"
if branch == "OpenSSL_1_0_2-stable":
return "1.0.2"
print(f"Incorrect branch {branch}")
raise SystemExit(1)


def clone(branch: str, tmp_dir: str) -> None:
Expand Down Expand Up @@ -71,11 +77,12 @@ def build_site(version: str):


def main():
version = sys.argv[1]
branch = sys.argv[1]
version = get_version_from_branch(branch)
clean_docs()
create_dirs()
with tempfile.TemporaryDirectory() as tmp_dir:
clone(get_branch(version), tmp_dir)
clone(branch, tmp_dir)
if version not in ["1.0.2", "1.1.1"]:
build_manpages(tmp_dir)
convert_pod_to_md(tmp_dir)
Expand Down

0 comments on commit 1a6ca1e

Please sign in to comment.