skilleter-thingy 0.0.44__py3-none-any.whl → 0.0.45__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.

@@ -24,22 +24,28 @@ def main():
24
24
  # Command line parameters
25
25
 
26
26
  parser = argparse.ArgumentParser(description='Report top-level directory of the current git working tree.')
27
- parser.add_argument('-p', '--parent', action='store_true',
27
+ parser.add_argument('--parent', '-p', action='store_true',
28
28
  help='If we are already at the top of the working tree, check if the parent directory is in a working tree and output the top-level directory of that tree.')
29
- parser.add_argument('-r', '--repo', action='store_true',
29
+ parser.add_argument('--repo', '-r', action='store_true',
30
30
  help='If we are already at the top of the working tree, look for a parent directory with a repo control file (.repo directory or .mrconfig file) and output that directory.')
31
+ parser.add_argument('--dir', '-d', action='store', default=os.getcwd(),
32
+ help='Find the location of the top-level directory in the working tree starting at the specified directory')
31
33
  parser.add_argument('level', nargs='?', type=int, default=0, help='Number of levels below the top-level directory to report')
32
34
  args = parser.parse_args()
33
35
 
34
- try:
35
- start_dir = os.getcwd()
36
- except FileNotFoundError:
37
- print('Unable to locate current directory')
36
+ if not os.path.isdir(args.dir):
37
+ print(f'Unable to locate directory {args.dir}')
38
38
  sys.exit(1)
39
39
 
40
40
  # Try to get the current working tree
41
41
 
42
- working_tree = pygit2.discovery_repository(start_dir)
42
+ git_dir = pygit2.discover_repository(args.dir)
43
+
44
+ if not git_dir:
45
+ print(f'Directory {args.dir} is not in a Git working tree')
46
+ sys.exit(2)
47
+
48
+ working_tree = os.path.abspath(os.path.join(git_dir, os.pardir))
43
49
 
44
50
  # If we are in a working tree and also looking for the parent working
45
51
  # tree, check if we are at the top of the current tree, and, if so,
@@ -51,7 +57,7 @@ def main():
51
57
  if os.path.samefile(working_tree, current_directory):
52
58
  os.chdir('..')
53
59
 
54
- working_tree = pygit2.discovery_repository()
60
+ working_tree = pygit2.discover_repository()
55
61
 
56
62
  # If we are also looking for a multi-repo control file or directory, and haven't
57
63
  # found the git working tree root scan up the tree until we find one.
@@ -71,7 +77,7 @@ def main():
71
77
  # Output the result, if we have one
72
78
 
73
79
  if args.level:
74
- start = start_dir.split('/')
80
+ start = args.dir.split('/')
75
81
  working = working_tree.split('/')
76
82
 
77
83
  working_tree = os.path.join(working_tree, '/'.join(start[len(working):len(working) + int(args.level)]))
@@ -0,0 +1,47 @@
1
+ TEMPLATE = \
2
+ """#!/usr/bin/env bash
3
+
4
+ set -e
5
+
6
+ ################################################################################
7
+
8
+ VENV_NAME=$(basename "$0")
9
+ VENV_DIR=__venv__
10
+
11
+ GREEN="\e[42m"
12
+ NORMAL="\e[0m"
13
+
14
+ ################################################################################
15
+
16
+ function box()
17
+ {
18
+ echo -e "${GREEN}################################################################################${NORMAL}"
19
+ echo -e "${GREEN}# $@${NORMAL}"
20
+ echo -e "${GREEN}################################################################################${NORMAL}"
21
+ }
22
+
23
+ ################################################################################
24
+
25
+ box "Creating & activating $VENV_NAME virtual environment"
26
+
27
+ python3 -m venv $VENV_DIR
28
+
29
+ source $VENV_DIR/bin/activate
30
+
31
+ if [[ -f requirements.txt ]]
32
+ then
33
+ box "Installing/Upgrading packages"
34
+
35
+ python3 -m pip install -r requirements.txt
36
+ fi
37
+
38
+ if [[ -f ${VENV_NAME} ]]
39
+ then
40
+ box "Running ${VENV_NAME} script"
41
+
42
+ python3 ./${VENV_NAME}.py "$@"
43
+
44
+ deactivate
45
+ fi
46
+ """
47
+
@@ -0,0 +1,41 @@
1
+ TEMPLATE = \
2
+ """#!/usr/bin/env fish
3
+
4
+ ################################################################################
5
+
6
+ set VENV_NAME $(basename "$0")
7
+ set VENV_DIR __venv__
8
+
9
+ set GREEN "\e[42m"
10
+ set NORMAL "\e[0m"
11
+
12
+ ################################################################################
13
+
14
+ function box
15
+ echo -e "$GREEN################################################################################$NORMAL"
16
+ echo -e "$GREEN# $argv$NORMAL"
17
+ echo -e "$GREEN################################################################################$NORMAL"
18
+ end
19
+
20
+ ################################################################################
21
+
22
+ box "Creating & activating $VENV_NAME virtual environment"
23
+
24
+ python3 -m venv $VENV_DIR
25
+
26
+ source $VENV_DIR/bin/activate.fish
27
+
28
+ if test -f requirements.txt
29
+ box "Installing/Upgrading packages"
30
+
31
+ python3 -m pip install -r requirements.txt
32
+ end
33
+
34
+ if test -f $VENV_NAME.py
35
+ box "Running $VENV_NAME script"
36
+
37
+ python3 ./$VENV_NAME.py $argv
38
+
39
+ deactivate
40
+ end
41
+ """
@@ -4,51 +4,8 @@ import os
4
4
  import stat
5
5
  import argparse
6
6
 
7
- ################################################################################
8
-
9
- TEMPLATE = \
10
- """#!/usr/bin/env bash
11
-
12
- set -e
13
-
14
- ################################################################################
15
-
16
- VENV_NAME=$(basename "$0")
17
- VENV_DIR=__venv__
18
-
19
- GREEN="\e[42m"
20
- NORMAL="\e[0m"
21
-
22
- ################################################################################
23
-
24
- function box()
25
- {
26
- echo -e "${GREEN}################################################################################${NORMAL}"
27
- echo -e "${GREEN}# $@${NORMAL}"
28
- echo -e "${GREEN}################################################################################${NORMAL}"
29
- }
30
-
31
- ################################################################################
32
-
33
- box "Creating & activating $VENV_NAME virtual environment"
34
-
35
- python3 -m venv $VENV_DIR
36
-
37
- source $VENV_DIR/bin/activate
38
-
39
- if [[ -f requirements.txt ]]
40
- then
41
- box "Installing/Upgrading packages"
42
-
43
- python3 -m pip install -r requirements.txt
44
- fi
45
-
46
- box "Running ${VENV_NAME} script"
47
-
48
- python3 ./${VENV_NAME}.py "$@"
49
-
50
- deactivate
51
- """
7
+ import thingy.bash_venv as bash_venv
8
+ import thingy.fish_venv as fish_venv
52
9
 
53
10
  ################################################################################
54
11
 
@@ -60,13 +17,25 @@ def main():
60
17
 
61
18
  args = parser.parse_args()
62
19
 
20
+ shell = os.getenv('SHELL').split('/')[-1]
21
+
22
+ if shell == 'fish':
23
+ template = fish_venv.TEMPLATE
24
+ else:
25
+ if shell != 'bash':
26
+ print(f'Warning: Unknown shell: {shell} - using Bash template by default')
27
+
28
+ template = bash_venv.TEMPLATE
29
+
63
30
  with open(args.name[0], 'wt') as scriptfile:
64
- scriptfile.write(TEMPLATE)
31
+ scriptfile.write(template)
65
32
 
66
33
  statinfo = os.stat(args.name[0])
67
34
 
68
35
  os.chmod(args.name[0], statinfo.st_mode|stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
69
36
 
37
+ print(f'Created virtual environment: {args.name[0]}')
38
+
70
39
  ################################################################################
71
40
 
72
41
  def venv_create():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skilleter_thingy
3
- Version: 0.0.44
3
+ Version: 0.0.45
4
4
  Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
5
  Author-email: John Skilleter <john@skilleter.org.uk>
6
6
  Project-URL: Home, https://skilleter.org.uk
@@ -17,7 +17,7 @@ skilleter_thingy/git_mr.py,sha256=BCE68hhz2bV0zwHkEv5tyfRY0aXoUdb_aJ-yWYDu_Wo,30
17
17
  skilleter_thingy/git_parent.py,sha256=D47D01dPs6kActusA0ircJYTv8tBjDoe8MzMpJVWJpA,2683
18
18
  skilleter_thingy/git_review.py,sha256=1_vGcEgy6TvzoXIIDqsOeRZ4qeweDeNPuLwDQsEH08k,51769
19
19
  skilleter_thingy/git_update.py,sha256=2SAGeqL2LjdsXTYak3nvPtNfhSOWJdXZfAUx6bqC8Qw,13972
20
- skilleter_thingy/git_wt.py,sha256=T5_jTJjTWypiTq6zWCsonSGE6dl4iwpY9II6ScCbhVs,3139
20
+ skilleter_thingy/git_wt.py,sha256=kMxA3f39-gMjXfhLH4DHw9klsgPbJzn1Ae4osehbtD8,3487
21
21
  skilleter_thingy/gitcmp_helper.py,sha256=_3ji-PyIF2oI6a4zyUPjLeCFgAtACykxPpOrbjD6-aw,11245
22
22
  skilleter_thingy/gitprompt.py,sha256=SzSMd0EGI7ftPko80Q2PipwbVA-qjU1jsmdpmTCM5GI,8912
23
23
  skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
@@ -37,11 +37,12 @@ skilleter_thingy/sysmon.py,sha256=XRZG6EVSzoVYan_N16qVB1l1RaU51uvLWlRA0CDjC54,11
37
37
  skilleter_thingy/tfm.py,sha256=3ejKNI2P65lGz-50mxRMxW_o5NmoeMDcmhji_0uALhI,33703
38
38
  skilleter_thingy/tfparse.py,sha256=u1IZH2J_WH1aORyMozKSI2JKok7_S1MMJhiobzmhlUI,2988
39
39
  skilleter_thingy/trimpath.py,sha256=IJU3zl4Hg08g0eU24LZyDlGfNa-5k-TZM5s9zR4OIdA,2385
40
- skilleter_thingy/venv_create.py,sha256=QOoAfZblufVUCxZc66t39b_A5D0-hPGragkP1teB7mo,2072
40
+ skilleter_thingy/venv_create.py,sha256=JZzOGbGJehNIGuumeZG0jrtU2M0ijvLE67NqjLXfxyg,1428
41
41
  skilleter_thingy/window_rename.py,sha256=dCBgZqih_3YKHt35hsOAhARFp3QxOi8w8huC63sqJK8,3128
42
42
  skilleter_thingy/xchmod.py,sha256=F9_lxKuLqVlHHr3oBI3dkMoFOuwRzYDlpQMTmDcjpBI,4590
43
43
  skilleter_thingy/yamlcheck.py,sha256=FXylZ5NtHirDlPVhVEUZUZkTugVR-g51BbjaN06akAc,2868
44
44
  skilleter_thingy/thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
45
+ skilleter_thingy/thingy/bash_venv.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
45
46
  skilleter_thingy/thingy/colour.py,sha256=D-RTYsND6Xm6m3xl0mOe9QSrTNYsyY0K_a8x3id2gvg,7031
46
47
  skilleter_thingy/thingy/dc_curses.py,sha256=fuuQPR11zV_akAhygL_cAhVLC5YAgKgowzlITVbETE8,8539
47
48
  skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5ubwI4CCYBk,6170
@@ -49,6 +50,7 @@ skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUs
49
50
  skilleter_thingy/thingy/dircolors.py,sha256=5NbXMsGWdABLvvZfB70VPmN6N5HyyihfpgoQq1NRJbg,12264
50
51
  skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
51
52
  skilleter_thingy/thingy/files.py,sha256=8wXUHEGALhHvYtJewjSNwHFw-hGHFYbWH9_40lJj5ZY,4257
53
+ skilleter_thingy/thingy/fish_venv.py,sha256=NKL9I5DKNyT7R6UpKRIiYmxg4kxzmywuuYO07uCBCrQ,1004
52
54
  skilleter_thingy/thingy/git.py,sha256=9y58KhFx6t9nNyqMbixM5cl8LBcD2sdCh9UgyVPv4bo,38043
53
55
  skilleter_thingy/thingy/git2.py,sha256=xfQrOpOk4SLdE6T-pr0FTuYGn0gSY92VMDpmqvX3gDM,35751
54
56
  skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
@@ -59,9 +61,9 @@ skilleter_thingy/thingy/process.py,sha256=88pKHQZXBP1m3Ja7t3DtKJ4Njn7HS2OtcI0Z0i
59
61
  skilleter_thingy/thingy/run.py,sha256=051lGahG4liYLckQFpmSaGuE9Chd-lFdmJO85LdmeXE,12607
60
62
  skilleter_thingy/thingy/tfm_pane.py,sha256=40DmQeLMEUPiKKIJkgN1MEpIen00V70I1HB7Q6git44,19814
61
63
  skilleter_thingy/thingy/tidy.py,sha256=wzkyxzCsHXyY46G3Rjqu4ZrqiL8QMbRXyJEeYOmpy-o,5402
62
- skilleter_thingy-0.0.44.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
63
- skilleter_thingy-0.0.44.dist-info/METADATA,sha256=LJ50JU50_euiz0igXs6KsMtUSVHcEXIqSHoo62qbV48,5313
64
- skilleter_thingy-0.0.44.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
65
- skilleter_thingy-0.0.44.dist-info/entry_points.txt,sha256=IT6cZSbGHrd2UzIQbiMRotKiTJnYJBkESC4fAe8gjsE,2026
66
- skilleter_thingy-0.0.44.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
67
- skilleter_thingy-0.0.44.dist-info/RECORD,,
64
+ skilleter_thingy-0.0.45.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
+ skilleter_thingy-0.0.45.dist-info/METADATA,sha256=00YYxQOpeYPEng-K6B4hx-1WxPGu_pbnA55MVZ65wYs,5313
66
+ skilleter_thingy-0.0.45.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
67
+ skilleter_thingy-0.0.45.dist-info/entry_points.txt,sha256=IT6cZSbGHrd2UzIQbiMRotKiTJnYJBkESC4fAe8gjsE,2026
68
+ skilleter_thingy-0.0.45.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
+ skilleter_thingy-0.0.45.dist-info/RECORD,,