port build-script from SDL3
[ci skip]
This commit is contained in:
parent
c98c4fbff6
commit
4fc47a774f
7 changed files with 1265 additions and 350 deletions
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
|
@ -9,17 +10,18 @@ import subprocess
|
|||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def determine_project() -> str:
|
||||
text = (ROOT / "CMakeLists.txt").read_text()
|
||||
match = next(re.finditer(r"project\((?P<project>[a-zA-Z0-9_]+)\s+", text, flags=re.M))
|
||||
project_with_version = match["project"]
|
||||
def determine_remote() -> str:
|
||||
text = (ROOT / "build-scripts/release-info.json").read_text()
|
||||
release_info = json.loads(text)
|
||||
if "remote" in release_info:
|
||||
return release_info["remote"]
|
||||
project_with_version = release_info["name"]
|
||||
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
|
||||
return project
|
||||
return f"libsdl-org/{project}"
|
||||
|
||||
|
||||
def main():
|
||||
project = determine_project()
|
||||
default_remote = f"libsdl-org/{project}"
|
||||
default_remote = determine_remote()
|
||||
|
||||
current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue