python-script-launcher 0.0.11__py3-none-any.whl → 0.0.13__py3-none-any.whl
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.
- python_script_launcher/__main__.py +42 -11
- python_script_launcher/make_exe.py +12 -3
- {python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/METADATA +1 -1
- {python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/RECORD +7 -7
- {python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/WHEEL +0 -0
- {python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/entry_points.txt +0 -0
- {python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/top_level.txt +0 -0
|
@@ -66,16 +66,41 @@ def cmd_run(args):
|
|
|
66
66
|
LAUNCHER_FILES = ["app.py", "client.py", "tasks.py"]
|
|
67
67
|
STATIC_DIR = "static"
|
|
68
68
|
SHIM_PKG = "python_script_launcher"
|
|
69
|
+
# Files placed inside the staged `python_script_launcher/` package so the
|
|
70
|
+
# frozen exe supports both `from python_script_launcher import task` and
|
|
71
|
+
# `from python_script_launcher.tasks import task`.
|
|
72
|
+
SHIM_SUBMODULES = ("tasks.py",)
|
|
69
73
|
SHIM_INIT = (
|
|
70
|
-
'"'*3 + "
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"from
|
|
74
|
+
'"'*3 + "Runtime shim generated by launcher build.\n\n"
|
|
75
|
+
"Re-exports the public API from ``python_script_launcher.tasks`` so both\n"
|
|
76
|
+
" from python_script_launcher import task\n"
|
|
77
|
+
" from python_script_launcher.tasks import task\n"
|
|
78
|
+
"work inside a frozen exe. The submodule is copied verbatim from the\n"
|
|
79
|
+
"installed launcher package.\n"
|
|
74
80
|
+ '"'*3 + "\n"
|
|
75
|
-
"from tasks import * # noqa: F401,F403\n"
|
|
76
|
-
"from tasks import task, run_cli, collect_tasks, TaskSpec, TaskParam # noqa: F401\n"
|
|
81
|
+
"from .tasks import * # noqa: F401,F403\n"
|
|
82
|
+
"from .tasks import task, run_cli, collect_tasks, TaskSpec, TaskParam # noqa: F401\n"
|
|
77
83
|
)
|
|
78
84
|
|
|
85
|
+
# Directories inside the user scripts tree that should NEVER be staged into
|
|
86
|
+
# the build sandbox. They are either build outputs, virtual envs, VCS, or
|
|
87
|
+
# editor metadata; copying them causes path-length blowups (when users run
|
|
88
|
+
# `build --scripts .` from a repo root that already contains a previous
|
|
89
|
+
# `dist/`) and needlessly bloats the exe.
|
|
90
|
+
SCRIPTS_SKIP_DIRS = {
|
|
91
|
+
"dist", "build", "_uploads",
|
|
92
|
+
".venv", "venv", "env", ".env",
|
|
93
|
+
"__pycache__", ".pytest_cache", ".mypy_cache", ".ruff_cache",
|
|
94
|
+
".git", ".hg", ".svn",
|
|
95
|
+
".idea", ".vscode", ".vs",
|
|
96
|
+
"node_modules", "site-packages", "_internal",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _scripts_ignore(dirpath, entries):
|
|
101
|
+
"""shutil.copytree(ignore=...) callback: skip build/env/VCS noise."""
|
|
102
|
+
return [e for e in entries if e in SCRIPTS_SKIP_DIRS]
|
|
103
|
+
|
|
79
104
|
|
|
80
105
|
def _stage_project(scripts_src: Path) -> Path:
|
|
81
106
|
"""Create a temp directory that mimics the launcher repo layout, so
|
|
@@ -89,16 +114,22 @@ def _stage_project(scripts_src: Path) -> Path:
|
|
|
89
114
|
static_src = PACKAGE_DIR / STATIC_DIR
|
|
90
115
|
if static_src.exists():
|
|
91
116
|
shutil.copytree(static_src, tmp / STATIC_DIR)
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
117
|
+
# Stage a real `python_script_launcher/` package next to the top-level
|
|
118
|
+
# runtime files. Copying `tasks.py` in as a submodule (plus a small
|
|
119
|
+
# re-export shim in __init__.py) makes both `from python_script_launcher
|
|
120
|
+
# import task` and `from python_script_launcher.tasks import task` work
|
|
121
|
+
# inside the frozen exe, matching what the wheel install exposes.
|
|
96
122
|
shim_dir = tmp / SHIM_PKG
|
|
97
123
|
shim_dir.mkdir(parents=True, exist_ok=True)
|
|
124
|
+
for name in SHIM_SUBMODULES:
|
|
125
|
+
src = PACKAGE_DIR / name
|
|
126
|
+
if src.exists():
|
|
127
|
+
shutil.copy2(src, shim_dir / name)
|
|
98
128
|
(shim_dir / "__init__.py").write_text(SHIM_INIT, encoding="utf-8", newline="\n")
|
|
99
129
|
# Copy user scripts into <tmp>/scripts so both scan_scripts and
|
|
100
130
|
# PyInstaller's --add-data pick them up.
|
|
101
|
-
shutil.copytree(scripts_src, tmp / "scripts",
|
|
131
|
+
shutil.copytree(scripts_src, tmp / "scripts",
|
|
132
|
+
dirs_exist_ok=True, ignore=_scripts_ignore)
|
|
102
133
|
return tmp
|
|
103
134
|
|
|
104
135
|
|
|
@@ -161,9 +161,17 @@ def build_exe(entry, name, *, project=None, dist=None, static=None,
|
|
|
161
161
|
# mirrors publish.py wheel layout and add its parent to `--paths`, so
|
|
162
162
|
# `from python_script_launcher.tasks import task` resolves the same
|
|
163
163
|
# way it does when installed from the wheel.
|
|
164
|
-
|
|
164
|
+
# If the caller already staged a python_script_launcher/ package into
|
|
165
|
+
# `project` (e.g. via __main__.cmd_build), reuse it verbatim so we do
|
|
166
|
+
# not end up with two competing copies of the same package on --paths.
|
|
167
|
+
if (project / "python_script_launcher" / "__init__.py").exists():
|
|
168
|
+
stage_root = None
|
|
169
|
+
else:
|
|
170
|
+
stage_root = _stage_launcher_package(project)
|
|
165
171
|
try:
|
|
166
|
-
cmd += ["--paths", str(project)
|
|
172
|
+
cmd += ["--paths", str(project)]
|
|
173
|
+
if stage_root is not None:
|
|
174
|
+
cmd += ["--paths", str(stage_root)]
|
|
167
175
|
if (project / "tasks.py").exists():
|
|
168
176
|
cmd += ["--hidden-import", "tasks"]
|
|
169
177
|
cmd += [
|
|
@@ -188,7 +196,8 @@ def build_exe(entry, name, *, project=None, dist=None, static=None,
|
|
|
188
196
|
out = f"{dist_dir}/{name}.exe" if onefile else f"{dist_dir}/{name}/{name}.exe"
|
|
189
197
|
print(f" [OK] {name} -> {out}\n")
|
|
190
198
|
finally:
|
|
191
|
-
|
|
199
|
+
if stage_root is not None:
|
|
200
|
+
shutil.rmtree(stage_root, ignore_errors=True)
|
|
192
201
|
|
|
193
202
|
|
|
194
203
|
def main():
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
python_script_launcher/__init__.py,sha256=XeqJdWwu4-26nBlxeu2urarg3chsKMYYAWKgbUQnUyo,1750
|
|
2
|
-
python_script_launcher/__main__.py,sha256=
|
|
2
|
+
python_script_launcher/__main__.py,sha256=HgtHOiJ_qKCIVZwbCf_a9tZSMbBEGS8lVAo77ryINSE,8173
|
|
3
3
|
python_script_launcher/app.py,sha256=Qr5GAhqiHaKs3eZUkJvsyMInDIPGcJb0m8pJ-D1zuUY,25211
|
|
4
4
|
python_script_launcher/client.py,sha256=pULe9xHv4OuXFAdiFAEHp4uxO8x4D_myyNX6ofqElMg,2964
|
|
5
|
-
python_script_launcher/make_exe.py,sha256=
|
|
5
|
+
python_script_launcher/make_exe.py,sha256=4K8gHnfg7FGgD1WvHaxwp9yk1MhpWGtJOXHYpZgc0Ws,8826
|
|
6
6
|
python_script_launcher/tasks.py,sha256=0f6P88vlUXscnIxXNL5pEQpmr6x-kavAHvDB9Z1qowE,5755
|
|
7
7
|
python_script_launcher/scripts/file_status.py,sha256=D22FwHlsNnJkHz7ICyM3L2xK3vhNaMRl-aJEERrEG8s,1063
|
|
8
8
|
python_script_launcher/scripts/hello.py,sha256=df5gR95rta5J0sDORI0wncCTBS0wGrTX07pEcR9R4_A,517
|
|
9
9
|
python_script_launcher/scripts/multi.py,sha256=2HApGhrdt8Xs1WZ9HY7yHXAlabqc1KRC6CHqTUhjWy0,590
|
|
10
10
|
python_script_launcher/scripts/test_modules.py,sha256=AFzAAC2NlYSVcPucNgChguLMEj8m1pmCIB3LIDthOf8,618
|
|
11
11
|
python_script_launcher/static/index.html,sha256=_HTLklrRge6A09l2kb5ucFI4rrm2KMIEgU9xXbPJzT8,15000
|
|
12
|
-
python_script_launcher-0.0.
|
|
13
|
-
python_script_launcher-0.0.
|
|
14
|
-
python_script_launcher-0.0.
|
|
15
|
-
python_script_launcher-0.0.
|
|
16
|
-
python_script_launcher-0.0.
|
|
12
|
+
python_script_launcher-0.0.13.dist-info/METADATA,sha256=xk789e-Eg0QuD2iraXSmmt_BzEwv4h5c6mVGAXr3uEU,6378
|
|
13
|
+
python_script_launcher-0.0.13.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
14
|
+
python_script_launcher-0.0.13.dist-info/entry_points.txt,sha256=13ENRmw4BsgWGLDCr_y1dKB91ed1j6rEyks6JDFzOns,66
|
|
15
|
+
python_script_launcher-0.0.13.dist-info/top_level.txt,sha256=Ap6WryIb1YRnr_QVCmfGjdEVLDNA3dQcTl_-gxX11qk,23
|
|
16
|
+
python_script_launcher-0.0.13.dist-info/RECORD,,
|
|
File without changes
|
{python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_script_launcher-0.0.11.dist-info → python_script_launcher-0.0.13.dist-info}/top_level.txt
RENAMED
|
File without changes
|