pyinstaller-plus 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyinstaller-plus
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.13
6
+ Requires-Dist: pyinstaller
@@ -0,0 +1,26 @@
1
+ # pyinstaller-plus
2
+
3
+ `pyinstaller-plus` wraps PyInstaller and runs DistroMate packaging after a successful build.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ pyinstaller-plus your.spec
9
+ ```
10
+
11
+ Publish after build:
12
+
13
+ ```bash
14
+ pyinstaller-plus -p --dm-version 1.2.3 your.spec
15
+ ```
16
+
17
+ If you need PyInstaller's `-p/--paths`, prefer `--paths` to avoid ambiguity:
18
+
19
+ ```bash
20
+ pyinstaller-plus --paths ./src --dm-version 1.2.3 your.spec
21
+ ```
22
+
23
+ ## Notes
24
+
25
+ - `distromate` must be installed and available on `PATH`.
26
+ - If `--dm-version` is omitted, the wrapper reads `project.version` from `pyproject.toml`.
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("pyinstaller-plus")
7
+ except PackageNotFoundError:
8
+ __version__ = "0.0.0"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from .cli import main
4
+
5
+
6
+ if __name__ == "__main__":
7
+ raise SystemExit(main())
@@ -0,0 +1,128 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import shutil
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+ from typing import Iterable, Tuple
9
+
10
+ try:
11
+ import tomllib
12
+ except ModuleNotFoundError: # pragma: no cover - Python <3.11
13
+ tomllib = None # type: ignore[assignment]
14
+
15
+
16
+ def _split_dm_args(argv: Iterable[str]) -> Tuple[list[str], bool, str | None]:
17
+ py_args: list[str] = []
18
+ publish = False
19
+ dm_version: str | None = None
20
+
21
+ args = list(argv)
22
+ i = 0
23
+ while i < len(args):
24
+ arg = args[i]
25
+
26
+ if arg == "--":
27
+ py_args.extend(args[i + 1 :])
28
+ break
29
+
30
+ if arg in {"--publish", "--dm-publish"}:
31
+ publish = True
32
+ i += 1
33
+ continue
34
+
35
+ if arg == "-p":
36
+ next_arg = args[i + 1] if i + 1 < len(args) else None
37
+ if next_arg and not next_arg.startswith("-"):
38
+ py_args.extend([arg, next_arg])
39
+ i += 2
40
+ else:
41
+ publish = True
42
+ i += 1
43
+ continue
44
+
45
+ if arg.startswith("--dm-version="):
46
+ dm_version = arg.split("=", 1)[1]
47
+ i += 1
48
+ continue
49
+
50
+ if arg == "--dm-version":
51
+ if i + 1 >= len(args):
52
+ raise SystemExit("Missing value for --dm-version.")
53
+ dm_version = args[i + 1]
54
+ i += 2
55
+ continue
56
+
57
+ py_args.append(arg)
58
+ i += 1
59
+
60
+ return py_args, publish, dm_version
61
+
62
+
63
+ def _read_pyproject_version(start_dir: Path) -> str | None:
64
+ if tomllib is None:
65
+ return None
66
+
67
+ for current in [start_dir, *start_dir.parents]:
68
+ pyproject = current / "pyproject.toml"
69
+ if not pyproject.is_file():
70
+ continue
71
+ try:
72
+ data = tomllib.loads(pyproject.read_bytes())
73
+ except Exception:
74
+ return None
75
+ return data.get("project", {}).get("version")
76
+
77
+ return None
78
+
79
+
80
+ def _run_command(cmd: list[str]) -> int:
81
+ print(f"[pyinstaller-plus] $ {' '.join(cmd)}")
82
+ try:
83
+ completed = subprocess.run(cmd, check=False)
84
+ except FileNotFoundError:
85
+ print(f"[pyinstaller-plus] Command not found: {cmd[0]}")
86
+ return 127
87
+ return completed.returncode
88
+
89
+
90
+ def _ensure_distromate() -> bool:
91
+ if shutil.which("distromate") is None:
92
+ print("[pyinstaller-plus] distromate CLI not found in PATH.")
93
+ return False
94
+ return True
95
+
96
+
97
+ def main(argv: list[str] | None = None) -> int:
98
+ args = sys.argv[1:] if argv is None else argv
99
+ py_args, publish, dm_version = _split_dm_args(args)
100
+
101
+ if not py_args:
102
+ py_args = ["-h"]
103
+
104
+ pyinstaller_cmd = [sys.executable, "-m", "PyInstaller", *py_args]
105
+ rc = _run_command(pyinstaller_cmd)
106
+ if rc != 0:
107
+ return rc
108
+ if len(py_args) == 1 and py_args[0] in {"-h", "--help", "--version"}:
109
+ return 0
110
+
111
+ if not _ensure_distromate():
112
+ return 127
113
+
114
+ if dm_version is None:
115
+ dm_version = _read_pyproject_version(Path(os.getcwd()))
116
+ if not dm_version:
117
+ print(
118
+ "[pyinstaller-plus] distromate version not specified. "
119
+ "Use --dm-version <version> to continue."
120
+ )
121
+ return 2
122
+
123
+ dm_cmd = ["distromate", "publish" if publish else "package", "-v", dm_version]
124
+ return _run_command(dm_cmd)
125
+
126
+
127
+ if __name__ == "__main__":
128
+ raise SystemExit(main())
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyinstaller-plus
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.13
6
+ Requires-Dist: pyinstaller
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ pyinstaller_plus/__init__.py
4
+ pyinstaller_plus/__main__.py
5
+ pyinstaller_plus/cli.py
6
+ pyinstaller_plus.egg-info/PKG-INFO
7
+ pyinstaller_plus.egg-info/SOURCES.txt
8
+ pyinstaller_plus.egg-info/dependency_links.txt
9
+ pyinstaller_plus.egg-info/entry_points.txt
10
+ pyinstaller_plus.egg-info/requires.txt
11
+ pyinstaller_plus.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ pyinstaller-plus = pyinstaller_plus.cli:main
3
+ pyinstaller_plus = pyinstaller_plus.cli:main
@@ -0,0 +1,2 @@
1
+ dist
2
+ pyinstaller_plus
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "pyinstaller-plus"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ requires-python = ">=3.13"
6
+ dependencies = [
7
+ "pyinstaller",
8
+ ]
9
+
10
+ [project.scripts]
11
+ pyinstaller-plus = "pyinstaller_plus.cli:main"
12
+ pyinstaller_plus = "pyinstaller_plus.cli:main"
13
+
14
+ [build-system]
15
+ requires = ["setuptools>=69", "wheel"]
16
+ build-backend = "setuptools.build_meta"
17
+
18
+ [tool.setuptools.packages.find]
19
+ where = ["."]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+