| 14 | |
| 15 | |
| 16 | def read_versions() -> Tuple[str, str]: |
| 17 | init_path = ROOT / "MCSL2Lib" / "__init__.py" |
| 18 | values: Dict[str, str] = {} |
| 19 | for node in ast.parse(init_path.read_text(encoding="utf-8")).body: |
| 20 | if not isinstance(node, ast.Assign) or len(node.targets) != 1: |
| 21 | continue |
| 22 | target = node.targets[0] |
| 23 | if isinstance(target, ast.Name) and target.id in {"VERSION", "BUILD_VERSION"}: |
| 24 | value = ast.literal_eval(node.value) |
| 25 | if isinstance(value, str): |
| 26 | values[target.id] = value |
| 27 | return values.get("VERSION", "2.0"), values.get("BUILD_VERSION", "0.3") |
| 28 | |
| 29 | |
| 30 | def build_args(extra_args: List[str]) -> List[str]: |