pystand 2.0__py3-none-any.whl → 2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pystand
3
- Version: 2.0
3
+ Version: 2.2
4
4
  Summary: Install Python versions from python-build-standalone project
5
5
  Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
6
  License: GPLv3
@@ -281,17 +281,17 @@ options:
281
281
  ### Command `path`
282
282
 
283
283
  ```
284
- usage: pystand path [-h] [-p] [version]
284
+ usage: pystand path [-h] [-p] [-c | version]
285
285
 
286
286
  Show path prefix to installed version base directory.
287
287
 
288
288
  positional arguments:
289
- version version to return path for, or latest installed version
290
- if not specified
289
+ version print resolved path for specified version
291
290
 
292
291
  options:
293
- -h, --help show this help message and exit
294
- -p, --python-path return full path to python executable
292
+ -h, --help show this help message and exit
293
+ -p, --python-path show full path to python executable
294
+ -c, --cache-prefix print path to cache dir
295
295
  ```
296
296
 
297
297
  ## Installation and Upgrade
@@ -0,0 +1,6 @@
1
+ pystand.py,sha256=tOQ4SxeqAtz3Tc-kd9jt_v-Hbx_vXnatHPkT5f1pdAA,33114
2
+ pystand-2.2.dist-info/METADATA,sha256=45hYFkXnngYMEDtsQ_lciU38qxK-Jl98ZxXyjvhhd2I,17403
3
+ pystand-2.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
4
+ pystand-2.2.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
+ pystand-2.2.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
+ pystand-2.2.dist-info/RECORD,,
pystand.py CHANGED
@@ -126,7 +126,8 @@ def rm_path(path: Path) -> None:
126
126
  elif path.exists():
127
127
  path.unlink()
128
128
 
129
- def unpack_zst(filename, extract_dir):
129
+ def unpack_zst(filename: str, extract_dir: str) -> None:
130
+ 'Unpack a zstandard compressed tar'
130
131
  with open(filename, 'rb') as compressed:
131
132
  dctx = zstandard.ZstdDecompressor()
132
133
  with dctx.stream_reader(compressed) as reader:
@@ -218,7 +219,8 @@ class VersionMatcher:
218
219
  def iter_versions(args: Namespace) -> Iterator[Path]:
219
220
  'Iterate over all version dirs'
220
221
  for f in args._versions.iterdir():
221
- if f.is_dir() and not f.is_symlink() and not f.name.startswith('.'):
222
+ if f.is_dir() and not f.is_symlink() \
223
+ and f.name[0] != '.' and f.name[0].isdigit():
222
224
  yield f
223
225
 
224
226
  def get_version_names(args: Namespace) -> list[str]:
@@ -359,7 +361,7 @@ def update_version_symlinks(args: Namespace) -> None:
359
361
  oldlinks = {}
360
362
  vers = []
361
363
  for path in base.iterdir():
362
- if not path.name.startswith('.'):
364
+ if path.name[0] != '.' and path.name[0].isdigit():
363
365
  if path.is_symlink():
364
366
  oldlinks[path.name] = os.readlink(str(path))
365
367
  else:
@@ -602,8 +604,8 @@ def main() -> str | None:
602
604
  'using -D/--distribution option.')
603
605
 
604
606
  # Keep some useful info in the namespace passed to the command
605
- prefix_dir = Path(args.prefix_dir).expanduser()
606
- cache_dir = Path(args.cache_dir).expanduser()
607
+ prefix_dir = Path(args.prefix_dir).expanduser().resolve()
608
+ cache_dir = Path(args.cache_dir).expanduser().resolve()
607
609
 
608
610
  args._distribution = distribution
609
611
  args._data = f'{PROG}.json'
@@ -869,15 +871,29 @@ class _path(COMMAND):
869
871
  @staticmethod
870
872
  def init(parser: ArgumentParser) -> None:
871
873
  parser.add_argument('-p', '--python-path', action='store_true',
872
- help='return full path to python executable')
873
- parser.add_argument('version', nargs='?',
874
- help='version to return path for, or latest '
875
- 'installed version if not specified')
874
+ help='show full path to python executable')
875
+ group = parser.add_mutually_exclusive_group()
876
+ group.add_argument('-c', '--cache-prefix', action='store_true',
877
+ help='print path to cache dir')
878
+ group.add_argument('version', nargs='?',
879
+ help='print resolved path for specified version')
876
880
 
877
881
  @staticmethod
878
882
  def run(args: Namespace) -> str | None:
883
+ if args.cache_prefix:
884
+ if args.python_path:
885
+ args.parser.error('Can not specify --python-path.')
886
+ print(args._downloads.parent)
887
+ return
888
+
889
+ if not args.version:
890
+ if args.python_path:
891
+ args.parser.error('Can not specify --python-path.')
892
+ print(args._versions)
893
+ return
894
+
879
895
  matcher = VersionMatcher([f.name for f in iter_versions(args)])
880
- version = matcher.match(args.version) or args.version
896
+ version = matcher.match(args.version)
881
897
  if not version:
882
898
  return 'No Python version installed.'
883
899
 
@@ -1,6 +0,0 @@
1
- pystand.py,sha256=UqlzHehVQ6gsP0p4CmVqrkYoaV6w5t0mO7y1d6VYkR0,32507
2
- pystand-2.0.dist-info/METADATA,sha256=P6edgnJxiBTLN_iRj9fphdhOLW3nmRMJsZo4SOZA-EI,17403
3
- pystand-2.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
4
- pystand-2.0.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
- pystand-2.0.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
- pystand-2.0.dist-info/RECORD,,
File without changes