ppqs 2.2.1__tar.gz → 2.3.1__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.
- {ppqs-2.2.1/src/ppqs.egg-info → ppqs-2.3.1}/PKG-INFO +1 -1
- {ppqs-2.2.1 → ppqs-2.3.1}/pyproject.toml +1 -1
- {ppqs-2.2.1 → ppqs-2.3.1/src/ppqs.egg-info}/PKG-INFO +1 -1
- {ppqs-2.2.1 → ppqs-2.3.1}/src/py_proj_quick_scripts/__init__.py +15 -19
- {ppqs-2.2.1 → ppqs-2.3.1}/test/test_cli.py +4 -4
- {ppqs-2.2.1 → ppqs-2.3.1}/LICENSES/MIT.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/README.md +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/setup.cfg +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/src/ppqs.egg-info/SOURCES.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/src/ppqs.egg-info/dependency_links.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/src/ppqs.egg-info/entry_points.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/src/ppqs.egg-info/requires.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/src/ppqs.egg-info/top_level.txt +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/test/test_find_pyproject.py +0 -0
- {ppqs-2.2.1 → ppqs-2.3.1}/test/test_parse_scripts.py +0 -0
|
@@ -233,24 +233,6 @@ def run_script(scripts, script_name, argv, cwd, has_been_run):
|
|
|
233
233
|
for command in script["commands"]:
|
|
234
234
|
cmd = []
|
|
235
235
|
|
|
236
|
-
cmd_exec = command.pop(0)
|
|
237
|
-
if cmd_exec == "ppqs":
|
|
238
|
-
|
|
239
|
-
# Recursively run script
|
|
240
|
-
# - silently ignore scripts which have already been run
|
|
241
|
-
script_name_r = command.pop(0)
|
|
242
|
-
if script_name_r not in has_been_run:
|
|
243
|
-
run_script(scripts, script_name_r, argv, cwd, has_been_run)
|
|
244
|
-
continue
|
|
245
|
-
|
|
246
|
-
elif cmd_exec == "python":
|
|
247
|
-
|
|
248
|
-
# Use same Python as ppqs to run Python scripts
|
|
249
|
-
cmd.append(sys.executable)
|
|
250
|
-
|
|
251
|
-
else:
|
|
252
|
-
cmd.append(cmd_exec)
|
|
253
|
-
|
|
254
236
|
for arg in command:
|
|
255
237
|
if isinstance(arg, Path):
|
|
256
238
|
if "*" in arg.parts[-1]:
|
|
@@ -269,6 +251,20 @@ def run_script(scripts, script_name, argv, cwd, has_been_run):
|
|
|
269
251
|
else:
|
|
270
252
|
cmd.append(arg)
|
|
271
253
|
|
|
254
|
+
if cmd[0] == "ppqs":
|
|
255
|
+
|
|
256
|
+
# Recursively run script
|
|
257
|
+
# - silently ignore scripts which have already been run
|
|
258
|
+
script_name_r = cmd[1]
|
|
259
|
+
if script_name_r not in has_been_run:
|
|
260
|
+
run_script(scripts, script_name_r, cmd[2:], cwd, has_been_run)
|
|
261
|
+
continue
|
|
262
|
+
|
|
263
|
+
elif cmd[0] == "python":
|
|
264
|
+
|
|
265
|
+
# Use same Python as ppqs to run Python scripts
|
|
266
|
+
cmd[0] = sys.executable
|
|
267
|
+
|
|
272
268
|
# Print header
|
|
273
269
|
if script["print-header"]:
|
|
274
270
|
cmd_str = " ".join(cmd)
|
|
@@ -276,7 +272,7 @@ def run_script(scripts, script_name, argv, cwd, has_been_run):
|
|
|
276
272
|
print(header, flush=True)
|
|
277
273
|
|
|
278
274
|
# Run command
|
|
279
|
-
retn = subprocess.run(cmd,
|
|
275
|
+
retn = subprocess.run(cmd, shell=False, cwd=cwd)
|
|
280
276
|
if retn.returncode != 0:
|
|
281
277
|
raise SystemExit(retn.returncode)
|
|
282
278
|
|
|
@@ -39,11 +39,11 @@ def pyproject_path(tmp_path):
|
|
|
39
39
|
["python", "-c", "import sys; print(*sys.argv[1:])", ["subdir", "*.txt"]],
|
|
40
40
|
]
|
|
41
41
|
[tool.ppqs.scripts.greeting]
|
|
42
|
-
script = "echo Hello"
|
|
42
|
+
script = "echo Hello ..."
|
|
43
43
|
[tool.ppqs.scripts.farewell]
|
|
44
44
|
script = '''
|
|
45
|
-
ppqs greeting
|
|
46
|
-
ppqs greeting
|
|
45
|
+
ppqs greeting friend!
|
|
46
|
+
ppqs greeting comrade!
|
|
47
47
|
echo Goodbye
|
|
48
48
|
'''
|
|
49
49
|
"""
|
|
@@ -131,7 +131,7 @@ def test_recursion(pyproject_path, capfd):
|
|
|
131
131
|
with in_dir(pyproject_path.parent):
|
|
132
132
|
cli("farewell")
|
|
133
133
|
captured = capfd.readouterr()
|
|
134
|
-
assert captured.out == "Hello
|
|
134
|
+
assert captured.out == "Hello friend!\nGoodbye\n"
|
|
135
135
|
assert captured.err == ""
|
|
136
136
|
|
|
137
137
|
with pytest.raises(InvalidScriptError):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|