Extracts the major.minor OpenSSL version from a version string. Example: "OpenSSL 3.0.16 11 Feb 2025" -> "3.0"
(version_string: str)
| 6 | import argparse |
| 7 | |
| 8 | def extract_major_minor(version_string: str) -> str: |
| 9 | """ |
| 10 | Extracts the major.minor OpenSSL version from a version string. |
| 11 | |
| 12 | Example: |
| 13 | "OpenSSL 3.0.16 11 Feb 2025" -> "3.0" |
| 14 | """ |
| 15 | match = re.search(r"(\d+\.\d+)", version_string) |
| 16 | if not match: |
| 17 | return "" |
| 18 | return match.group(1) |
| 19 | |
| 20 | parser = argparse.ArgumentParser(description="Check OpenSSL version used by Python Standalone Builds") |
| 21 | parser.add_argument("--expected", required=True, help="Expected OpenSSL version (found by CMake)") |
no test coverage detected