skilleter-thingy 0.2.6__py3-none-any.whl → 0.2.8__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.
Potentially problematic release.
This version of skilleter-thingy might be problematic. Click here for more details.
- skilleter_thingy/ggit.py +0 -1
- skilleter_thingy/ggrep.py +0 -1
- skilleter_thingy/git_br.py +0 -1
- skilleter_thingy/git_ca.py +0 -1
- skilleter_thingy/git_cleanup.py +1 -2
- skilleter_thingy/git_common.py +0 -1
- skilleter_thingy/git_hold.py +0 -1
- skilleter_thingy/git_mr.py +0 -1
- skilleter_thingy/git_parent.py +0 -1
- skilleter_thingy/git_retag.py +1 -1
- skilleter_thingy/git_review.py +0 -1
- skilleter_thingy/git_update.py +0 -1
- skilleter_thingy/git_wt.py +1 -1
- skilleter_thingy/gitcmp_helper.py +1 -1
- skilleter_thingy/gitprompt.py +0 -1
- skilleter_thingy/multigit.py +26 -35
- skilleter_thingy/rpylint.py +1 -2
- skilleter_thingy/tfparse.py +1 -1
- skilleter_thingy/thingy/docker.py +7 -5
- skilleter_thingy/thingy/files.py +2 -2
- skilleter_thingy/thingy/git.py +259 -187
- skilleter_thingy/thingy/process.py +20 -99
- skilleter_thingy/thingy/run.py +43 -0
- skilleter_thingy/thingy/venv_template.py +1 -1
- skilleter_thingy/trimpath.py +1 -1
- {skilleter_thingy-0.2.6.dist-info → skilleter_thingy-0.2.8.dist-info}/METADATA +1 -1
- skilleter_thingy-0.2.8.dist-info/RECORD +59 -0
- skilleter_thingy/thingy/git2.py +0 -1405
- skilleter_thingy-0.2.6.dist-info/RECORD +0 -60
- {skilleter_thingy-0.2.6.dist-info → skilleter_thingy-0.2.8.dist-info}/WHEEL +0 -0
- {skilleter_thingy-0.2.6.dist-info → skilleter_thingy-0.2.8.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.2.6.dist-info → skilleter_thingy-0.2.8.dist-info}/licenses/LICENSE +0 -0
- {skilleter_thingy-0.2.6.dist-info → skilleter_thingy-0.2.8.dist-info}/top_level.txt +0 -0
|
@@ -1,111 +1,32 @@
|
|
|
1
1
|
#! /usr/bin/env python3
|
|
2
2
|
|
|
3
3
|
################################################################################
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Licence: GPL v3 or later
|
|
4
|
+
""" Legacy compatibility module for process.py API.
|
|
5
|
+
This module provides backward compatibility for existing code that used
|
|
6
|
+
the original process.py module. The actual implementation has been moved
|
|
7
|
+
to thingy.run with enhanced capabilities.
|
|
9
8
|
"""
|
|
10
9
|
################################################################################
|
|
11
10
|
|
|
12
|
-
import
|
|
13
|
-
import sys
|
|
14
|
-
import logging
|
|
15
|
-
|
|
16
|
-
################################################################################
|
|
17
|
-
|
|
18
|
-
class RunError(Exception):
|
|
19
|
-
""" Run exception """
|
|
20
|
-
|
|
21
|
-
def __init__(self, msg, status=1):
|
|
22
|
-
super(RunError, self).__init__(msg)
|
|
23
|
-
self.msg = msg
|
|
24
|
-
self.status = status
|
|
25
|
-
|
|
26
|
-
################################################################################
|
|
11
|
+
from thingy.run import run_process, RunError
|
|
27
12
|
|
|
13
|
+
# Provide the same API as the original process.py
|
|
28
14
|
def run(command, foreground=False, shell=False):
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
foreground - set to True to run the command in the foreground, using stdin/err/out
|
|
32
|
-
shell - set to True to run the command inside a shell (allows the command to be specified
|
|
33
|
-
as a string, but needs spaces to bew quoted
|
|
34
|
-
Returns an empty array if foreground is True or an array of the output otherwise. """
|
|
35
|
-
|
|
36
|
-
# TODO: for background use subprocess.Popen but use devnull = open('/dev/null', 'w') for stdio and return proc instead of communicating with it?
|
|
37
|
-
|
|
38
|
-
logging.info('Running "%s"', ' '.join(command))
|
|
39
|
-
|
|
40
|
-
# If running in the foreground, run the command and either return an empty value
|
|
41
|
-
# on success (output is to the console) or raise a RunError
|
|
42
|
-
|
|
43
|
-
if foreground:
|
|
44
|
-
try:
|
|
45
|
-
if shell:
|
|
46
|
-
# TODO: Handle command lines with parameters containing spaces
|
|
47
|
-
command = ' '.join(command)
|
|
48
|
-
|
|
49
|
-
status = subprocess.run(command, shell=shell).returncode
|
|
50
|
-
if status:
|
|
51
|
-
raise RunError('Error %d' % status, status)
|
|
52
|
-
else:
|
|
53
|
-
return []
|
|
54
|
-
except OSError as exc:
|
|
55
|
-
raise RunError(exc)
|
|
56
|
-
else:
|
|
57
|
-
# Run the command and capture stdout and stderr
|
|
58
|
-
|
|
59
|
-
try:
|
|
60
|
-
proc = subprocess.run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
|
|
61
|
-
except OSError as exc:
|
|
62
|
-
raise RunError(exc)
|
|
63
|
-
|
|
64
|
-
logging.info('Stdout: %s', proc.stdout)
|
|
65
|
-
logging.info('Stderr: %s', proc.stderr)
|
|
66
|
-
|
|
67
|
-
# If it returned an error raise a RunError exception with the stdout text as the
|
|
68
|
-
# exception message
|
|
69
|
-
|
|
70
|
-
if proc.returncode:
|
|
71
|
-
raise RunError(proc.stderr)
|
|
72
|
-
|
|
73
|
-
# Otherwise return the stdout data or nothing
|
|
74
|
-
|
|
75
|
-
if proc.stdout:
|
|
76
|
-
output = proc.stdout.split('\n')
|
|
77
|
-
else:
|
|
78
|
-
output = []
|
|
79
|
-
|
|
80
|
-
# Remove trailing blank lines from the output
|
|
81
|
-
|
|
82
|
-
while output and output[-1] == '':
|
|
83
|
-
output = output[:-1]
|
|
84
|
-
|
|
85
|
-
logging.info('Output: %s', output)
|
|
86
|
-
return output
|
|
87
|
-
|
|
88
|
-
################################################################################
|
|
89
|
-
|
|
90
|
-
if __name__ == '__main__':
|
|
91
|
-
logging.basicConfig(level=logging.INFO)
|
|
92
|
-
|
|
93
|
-
print('Run ls -l:')
|
|
94
|
-
|
|
95
|
-
cmd_output = run(['ls', '-l'])
|
|
15
|
+
"""
|
|
16
|
+
Run a command with the original process.py API.
|
|
96
17
|
|
|
97
|
-
|
|
98
|
-
|
|
18
|
+
Args:
|
|
19
|
+
command: Command to run (string or list)
|
|
20
|
+
foreground: If True, run in foreground with output to console
|
|
21
|
+
shell: Whether to use shell for execution
|
|
99
22
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
run(['wombat'])
|
|
103
|
-
except RunError as exc:
|
|
104
|
-
print('Failed with error: %s' % exc.msg)
|
|
23
|
+
Returns:
|
|
24
|
+
List of output lines (empty if foreground=True)
|
|
105
25
|
|
|
106
|
-
|
|
107
|
-
|
|
26
|
+
Raises:
|
|
27
|
+
RunError: If command fails
|
|
28
|
+
"""
|
|
29
|
+
return run_process(command, foreground=foreground, shell=shell)
|
|
108
30
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
print('Not testing call to run() with foreground=True as stdout is not a TTY')
|
|
31
|
+
# Re-export RunError for compatibility
|
|
32
|
+
__all__ = ['run', 'RunError']
|
skilleter_thingy/thingy/run.py
CHANGED
|
@@ -288,6 +288,49 @@ def status(command, shell=False, output=False):
|
|
|
288
288
|
shell=shell,
|
|
289
289
|
exception=False)['status']
|
|
290
290
|
|
|
291
|
+
################################################################################
|
|
292
|
+
# Legacy compatibility layer for process.py API
|
|
293
|
+
|
|
294
|
+
def run_process(command, foreground=False, shell=False):
|
|
295
|
+
"""
|
|
296
|
+
Legacy compatibility function for process.py API.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
command: Command to run (string or list)
|
|
300
|
+
foreground: If True, run in foreground with output to console
|
|
301
|
+
shell: Whether to use shell for execution
|
|
302
|
+
|
|
303
|
+
Returns:
|
|
304
|
+
List of output lines (empty if foreground=True)
|
|
305
|
+
|
|
306
|
+
Raises:
|
|
307
|
+
RunError: If command fails
|
|
308
|
+
"""
|
|
309
|
+
if foreground:
|
|
310
|
+
# For foreground mode, output directly to console
|
|
311
|
+
try:
|
|
312
|
+
status_result = status(command, shell=shell, output=True)
|
|
313
|
+
if status_result != 0:
|
|
314
|
+
raise RunError(f"Command failed with return code {status_result}")
|
|
315
|
+
return [] # process.py returns empty list for foreground mode
|
|
316
|
+
except Exception as e:
|
|
317
|
+
if isinstance(e, RunError):
|
|
318
|
+
raise
|
|
319
|
+
raise RunError(f"Command failed: {str(e)}")
|
|
320
|
+
else:
|
|
321
|
+
# For background mode, capture and return output
|
|
322
|
+
try:
|
|
323
|
+
result = run(command, shell=shell, exception=True)
|
|
324
|
+
if isinstance(result, list):
|
|
325
|
+
return [line.rstrip() for line in result if line.strip()]
|
|
326
|
+
elif isinstance(result, str):
|
|
327
|
+
return [line.rstrip() for line in result.splitlines() if line.strip()]
|
|
328
|
+
return []
|
|
329
|
+
except Exception as e:
|
|
330
|
+
if isinstance(e, RunError):
|
|
331
|
+
raise
|
|
332
|
+
raise RunError(f"Command failed: {str(e)}")
|
|
333
|
+
|
|
291
334
|
################################################################################
|
|
292
335
|
|
|
293
336
|
if __name__ == '__main__':
|
skilleter_thingy/trimpath.py
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
skilleter_thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
|
|
2
|
+
skilleter_thingy/addpath.py,sha256=4Yhhgjjz1XDI98j0dAiQpNA2ejLefeWUTeSg3nIXQq0,3842
|
|
3
|
+
skilleter_thingy/console_colours.py,sha256=BOS9mo3jChx_FE8L1j488MDoVNgib11KjTRhrz_YRYE,1781
|
|
4
|
+
skilleter_thingy/docker_purge.py,sha256=PRQ7EBXymjYIHuJL4pk4r6KNn09IF28OGZ0ln57xtNg,3314
|
|
5
|
+
skilleter_thingy/ffind.py,sha256=rEgotUaMj9JxDCwz-7H5vdqxH_bXllaHqttwsOUGKj8,19235
|
|
6
|
+
skilleter_thingy/ggit.py,sha256=BL-DhNcz4Nd3sA-3Kl6gZ-zFtbNqOpyufvas-0aD8nk,2465
|
|
7
|
+
skilleter_thingy/ggrep.py,sha256=fnTzOI1Qbf7IY_TnStdx5uqeUhqSDkapxmhYgrONJHw,5887
|
|
8
|
+
skilleter_thingy/git_br.py,sha256=QdFU5HPLoV4YKX0bVLX_j_6Kv00TDenU6o3_ufbQAq8,6004
|
|
9
|
+
skilleter_thingy/git_ca.py,sha256=nkbxPS0BZQ8WXsiqf7dbcUyKXus6Bz4MSJ5olCWNUQQ,5168
|
|
10
|
+
skilleter_thingy/git_cleanup.py,sha256=22wrUNzd4BH3gi2ZL_rdw1vrPUNkJFb0pFFu_tuzhKs,10542
|
|
11
|
+
skilleter_thingy/git_co.py,sha256=Mc-6jEUpVWAJJ-2PTpQ4tjDw03_zJMJDX9SGIxCqzJQ,8404
|
|
12
|
+
skilleter_thingy/git_common.py,sha256=FKXB6aT-y_a3N6wFnnwM6qJi4ClLFvDAivkSQ4iEYP4,2111
|
|
13
|
+
skilleter_thingy/git_hold.py,sha256=coyHdl1bWivrWdmgs7smVPvHRNoXgsgmUjR6n-08lV4,4920
|
|
14
|
+
skilleter_thingy/git_mr.py,sha256=MsrAkIKW27fVTljV__zAjMveIpufvDQ_j0jeKJu2rZM,3426
|
|
15
|
+
skilleter_thingy/git_parent.py,sha256=VqP4v3zsWp6utJvxFxSB_GwCv82xNIiiBlAlkinO1Wk,2938
|
|
16
|
+
skilleter_thingy/git_retag.py,sha256=JT-yD-uU4dL0mxDq9IRynugUKqIxjMCdU1dYDjiBSTU,1828
|
|
17
|
+
skilleter_thingy/git_review.py,sha256=Z_e0wyQJ2AzOSy5cPI3jmAWystpJbHH4ygENjFagepo,52576
|
|
18
|
+
skilleter_thingy/git_update.py,sha256=Z3p3E33ZJ2DVa107UzaFR9V8LXADRuHjJL8TX3IhEa4,14348
|
|
19
|
+
skilleter_thingy/git_wt.py,sha256=tkGN_Bfz80icHNDVG8xuXVeUUR-xyZ3u8jopLRt1Ff4,2355
|
|
20
|
+
skilleter_thingy/gitcmp_helper.py,sha256=MlRimPj-S-ov44ETUvocRvfygs3cArP6WdSJCIJWNCs,11347
|
|
21
|
+
skilleter_thingy/gitprompt.py,sha256=SzSMd0EGI7ftPko80Q2PipwbVA-qjU1jsmdpmTCM5GI,8912
|
|
22
|
+
skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
|
|
23
|
+
skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
|
|
24
|
+
skilleter_thingy/multigit.py,sha256=FDB4MwsCE0DNbRsUXXxVIsFkVrRtFRlljwyy0Q72kYs,34914
|
|
25
|
+
skilleter_thingy/py_audit.py,sha256=4CAdqBAIIVcpTCn_7dGm56bdfGpUtUJofqTGZomClkY,4417
|
|
26
|
+
skilleter_thingy/readable.py,sha256=LcMMOiuzf9j5TsxcMbO0sbj6m1QCuABl91Hrv-YyIww,15422
|
|
27
|
+
skilleter_thingy/remdir.py,sha256=Ueg3a6_m7y50zWykhKk6pcuz4FKPjoLJVPo9gh_dsic,4653
|
|
28
|
+
skilleter_thingy/rmdupe.py,sha256=RWtOHq__zY4yOf6_Y-H-8RRJy31Sr3c8DEyTd6Y4oV4,17213
|
|
29
|
+
skilleter_thingy/rpylint.py,sha256=uAQRvscsW5x85P4COXE6HWk4XykBkRmGowAdViDkwi4,2601
|
|
30
|
+
skilleter_thingy/strreplace.py,sha256=zMhqC38KF0BddTsRM5Pa99HU3KXvxXg942qxRK-LALA,2539
|
|
31
|
+
skilleter_thingy/tfm.py,sha256=xMsqcuNJ32PwKF5vO3SO6etlbJKbCLUJhSdC2w0clwE,33829
|
|
32
|
+
skilleter_thingy/tfparse.py,sha256=rRoinnbq6sLfkT38yzzXi2jQuJgBIJoC--G05TVTDIc,2991
|
|
33
|
+
skilleter_thingy/trimpath.py,sha256=ijLowl-rxV53m0G75tGNuHWobObz5NreBy8yXP9l4eY,2373
|
|
34
|
+
skilleter_thingy/venv_create.py,sha256=EV_oZh3JlDc5hX5h9T1hnt65AEABw6PufaKvPYabR00,1159
|
|
35
|
+
skilleter_thingy/xchmod.py,sha256=T89xiH_po0nvH5T1AGgQOD5yhjKd9-LcHcmez3IORww,4604
|
|
36
|
+
skilleter_thingy/yamlcheck.py,sha256=FXylZ5NtHirDlPVhVEUZUZkTugVR-g51BbjaN06akAc,2868
|
|
37
|
+
skilleter_thingy/thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
|
|
38
|
+
skilleter_thingy/thingy/colour.py,sha256=mxHDpbUYad6xDsOKWco7CL0Nk3J5VKV_IZ3T5VjXwOI,7978
|
|
39
|
+
skilleter_thingy/thingy/dc_curses.py,sha256=fuuQPR11zV_akAhygL_cAhVLC5YAgKgowzlITVbETE8,8539
|
|
40
|
+
skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5ubwI4CCYBk,6170
|
|
41
|
+
skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUsMhOFs,1783
|
|
42
|
+
skilleter_thingy/thingy/dircolors.py,sha256=aBcq9ci855GSOIjrZWm8kG0ksCodvUmc4FlIOEOyBcA,12292
|
|
43
|
+
skilleter_thingy/thingy/docker.py,sha256=zFgLLGAmqGsBdy9SWhl6BVkPyng9vZygPe7dJylkTEc,2533
|
|
44
|
+
skilleter_thingy/thingy/files.py,sha256=jNnLpkhfmZ3W2uqdQvt-zI27FSwBLBERwAbsVeQ2TTs,4708
|
|
45
|
+
skilleter_thingy/thingy/git.py,sha256=XvP3vfNCgFEpmomdNwzs0Eu7aVKz1umzXre5WJGx2qQ,42753
|
|
46
|
+
skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
|
|
47
|
+
skilleter_thingy/thingy/path.py,sha256=8uM2Q9zFRWv_SaVOX49PeecQXttl7J6lsmBuRXWsXKY,4732
|
|
48
|
+
skilleter_thingy/thingy/popup.py,sha256=hNfA9yh4jCv2su8XK33udcTWwgf98noBdYRRkFX1mxc,2517
|
|
49
|
+
skilleter_thingy/thingy/process.py,sha256=R8JXKaxJJ6rgnSdJYJIsJ7Ox2e-5nPV1EJ0sjGZGxec,1092
|
|
50
|
+
skilleter_thingy/thingy/run.py,sha256=mqafCzW9op_xKCt8OY3jJ6YltmoOJGh44vzl667mwws,14196
|
|
51
|
+
skilleter_thingy/thingy/tfm_pane.py,sha256=XTTpSm71CyQyGmlVLuCthioOwech0jhUiFUXb-chS_Q,19792
|
|
52
|
+
skilleter_thingy/thingy/tidy.py,sha256=AQ2RawsZJg6WHrgayi_ZptFL9occ7suSdCHbU3P-cys,5971
|
|
53
|
+
skilleter_thingy/thingy/venv_template.py,sha256=ZfUvi8qFNGrk7J030Zy57xjwMtfIArJyqa-MqafyjVk,1016
|
|
54
|
+
skilleter_thingy-0.2.8.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
55
|
+
skilleter_thingy-0.2.8.dist-info/METADATA,sha256=KO5mUx8lFuo9HCvU6_7mh8ojr7FRv8mZOjwht8RU1FQ,28913
|
|
56
|
+
skilleter_thingy-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
57
|
+
skilleter_thingy-0.2.8.dist-info/entry_points.txt,sha256=MTNWf8jOx8Fy3tSwVLCZPlEyzlDF36odw-IN-cSefP8,1784
|
|
58
|
+
skilleter_thingy-0.2.8.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
59
|
+
skilleter_thingy-0.2.8.dist-info/RECORD,,
|