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

@@ -8,7 +8,6 @@ import argparse
8
8
  import fnmatch
9
9
  import configparser
10
10
  import shlex
11
- import pathlib
12
11
  from collections import defaultdict
13
12
 
14
13
  import thingy.git2 as git
@@ -102,13 +101,23 @@ def select_git_repos(args, config):
102
101
  or, return them all if no relevant options specified"""
103
102
 
104
103
  for repo in config.sections():
105
- # If wildcards are specified, then only match wildcards
104
+ # If repos are specified, then only match according to wildcards, full
105
+ # path or just basename.
106
106
 
107
107
  if args.repos:
108
- for card in args.repos:
109
- if fnmatch.fnmatch(repo, card):
108
+ for entry in args.repos:
109
+ if '?' in entry or '*' in entry:
110
+ if fnmatch.fnmatch(repo, entry):
111
+ matching = True
112
+ break
113
+ elif '/' in entry:
114
+ if repo == entry:
115
+ matching = True
116
+ break
117
+ elif os.path.basename(repo) == entry:
110
118
  matching = True
111
119
  break
120
+
112
121
  else:
113
122
  matching = False
114
123
  else:
@@ -139,6 +148,7 @@ def branch_name(name, default_branch):
139
148
  ################################################################################
140
149
 
141
150
  def run_git_status(cmd, path, cont=False, redirect=True):
151
+ """Run a git command and exit if it fails"""
142
152
 
143
153
  output, status = git.git_run_status(cmd, path=path, redirect=redirect)
144
154
 
@@ -351,7 +361,7 @@ def mg_checkout(args, config, console):
351
361
  if not args.quiet:
352
362
  show_progress(console.columns, repo.name)
353
363
 
354
- branch = branch_name(args.branch or repo.name['default branch'])
364
+ branch = branch_name(args.branch, repo['default branch'])
355
365
 
356
366
  if git.branch(path=repo.name) != branch:
357
367
  colour.write(f'Checking out [BLUE:{branch}] in [BOLD:{repo.name}]')
@@ -407,7 +417,7 @@ def mg_update(args, config, console):
407
417
  git.checkout(default_branch, path=repo.name)
408
418
 
409
419
  if not args.quiet:
410
- colour.write(f'Pulling updates from remote', indent=4)
420
+ colour.write('Pulling updates from remote', indent=4)
411
421
 
412
422
  git.pull(path=repo.name)
413
423
 
@@ -457,6 +467,8 @@ def mg_dir(args, config, console):
457
467
  """Return the location of a working tree, given the name. Returns an
458
468
  error unless there is a unique match"""
459
469
 
470
+ # DONE: Should return location relative to the current directory or as absolute path
471
+
460
472
  _ = console
461
473
  _ = config
462
474
 
@@ -472,7 +484,17 @@ def mg_dir(args, config, console):
472
484
  elif len(location) > 1:
473
485
  error(f'Multiple matches with {dir}')
474
486
 
475
- colour.write(location[0])
487
+ colour.write(os.path.join(os.path.dirname(args.config)), location[0]))
488
+
489
+ ################################################################################
490
+
491
+ def mg_config(args, config, console):
492
+ """Output the path to the configuration file"""
493
+
494
+ _ = config
495
+ _ = console
496
+
497
+ colour.write(args.config)
476
498
 
477
499
  ################################################################################
478
500
 
@@ -510,10 +532,10 @@ def mg_review(args, config, console):
510
532
 
511
533
  ################################################################################
512
534
 
513
- def read_configuration(args):
535
+ def find_configuration(args):
514
536
  """If the configuration file name has path elements, try and read it, otherwise
515
537
  search up the directory tree looking for the configuration file.
516
- Returns the configuration data, or None if the configuration file
538
+ Returns configuration file path or None if the configuration file
517
539
  could not be found."""
518
540
 
519
541
  if '/' in args.config:
@@ -526,13 +548,7 @@ def read_configuration(args):
526
548
  config_path = os.path.dirname(config_path)
527
549
  config_file = os.path.join(config_path, args.config)
528
550
 
529
- config = configparser.ConfigParser()
530
-
531
- if os.path.isfile(config_file):
532
- config.read(config_file)
533
- return config
534
-
535
- return None
551
+ return config_file if os.path.isfile(config_file) else None
536
552
 
537
553
  ################################################################################
538
554
 
@@ -550,6 +566,7 @@ def main():
550
566
  'update': mg_update,
551
567
  'clean': mg_clean,
552
568
  'dir': mg_dir,
569
+ 'config': mg_config,
553
570
  'run': mg_run,
554
571
  'review': mg_review,
555
572
  }
@@ -604,6 +621,8 @@ def main():
604
621
  parser_dir = subparsers.add_parser('dir', help='Return the location of a working tree, given the repo name')
605
622
  parser_dir.add_argument('dir', nargs=1, action='store', help='The name of the working tree')
606
623
 
624
+ parser_config = subparsers.add_parser('config', help='Return the name and location of the configuration file')
625
+
607
626
  parser_run = subparsers.add_parser('run', help='Run any git command in each of the working trees')
608
627
  parser_run.add_argument('--cont', '-c', action='store_true', help='Continue if the command returns an error in any of the working trees')
609
628
  parser_run.add_argument('cmd', nargs=1, action='store', help='The command to run (should be quoted)')
@@ -625,7 +644,12 @@ def main():
625
644
 
626
645
  # If the configuration file exists, read it
627
646
 
628
- config = read_configuration(args)
647
+ config = configparser.ConfigParser()
648
+
649
+ args.config = find_configuration(args)
650
+
651
+ if args.config:
652
+ config.read(args.config)
629
653
 
630
654
  # Command-specific validation
631
655
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: skilleter_thingy
3
- Version: 0.0.81
3
+ Version: 0.0.83
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
@@ -25,7 +25,7 @@ skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
25
25
  skilleter_thingy/gphotosync.py,sha256=Vb2zYTEFp26BYdkG810SRg9afyfDqvq4CLHTk-MFf60,22388
26
26
  skilleter_thingy/linecount.py,sha256=5voQtjJjDCVx4zjPwVRy620NpuLiwwFitzxjIsRGtxQ,4310
27
27
  skilleter_thingy/moviemover.py,sha256=j_Xb9_jFdgpFBAXcF4tEqbnKH_FonlnUU39LiCK980k,4470
28
- skilleter_thingy/multigit.py,sha256=LPZjl2-VzTtAQRVozxgu7QAaVqiIylcKlYstnJcf9Dw,26021
28
+ skilleter_thingy/multigit.py,sha256=9-IFOlHH7Xcxqr91OVu0F78NX5DaaFwCtwqjP5pgIBc,26948
29
29
  skilleter_thingy/photodupe.py,sha256=l0hbzSLb2Vk2ceteg-x9fHXCEE1uUuFo84hz5rsZUPA,4184
30
30
  skilleter_thingy/phototidier.py,sha256=5gSjlINUxf3ZQl3NG0o7CsWwODvTbokIMIafLFvn8Hc,7818
31
31
  skilleter_thingy/py_audit.py,sha256=xJm5k5qyeA6ii8mODa4dOkmP8L1drv94UHuxR54RsIM,4384
@@ -61,9 +61,9 @@ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1U
61
61
  skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
62
62
  skilleter_thingy/thingy/tidy.py,sha256=71DCyj0VJrj52RmjQyj1eOiQJIfy5EIPHuThOrS6ZTA,5876
63
63
  skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
64
- skilleter_thingy-0.0.81.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
- skilleter_thingy-0.0.81.dist-info/METADATA,sha256=Jvbejh1CK4TUDqNgFuJ2VrFASRHf-d5n2u0O6uWbg_8,6113
66
- skilleter_thingy-0.0.81.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
- skilleter_thingy-0.0.81.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
68
- skilleter_thingy-0.0.81.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
- skilleter_thingy-0.0.81.dist-info/RECORD,,
64
+ skilleter_thingy-0.0.83.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
+ skilleter_thingy-0.0.83.dist-info/METADATA,sha256=6_ACyV5SAnSA9JafWITy8ypToClvbS9KfNp3HfXcetY,6113
66
+ skilleter_thingy-0.0.83.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
+ skilleter_thingy-0.0.83.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
68
+ skilleter_thingy-0.0.83.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
+ skilleter_thingy-0.0.83.dist-info/RECORD,,