pystand 2.25__tar.gz → 2.26__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystand
3
- Version: 2.25
3
+ Version: 2.26
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-Expression: GPL-3.0-or-later
@@ -335,7 +335,7 @@ options:
335
335
  ### Command `cache`
336
336
 
337
337
  ```
338
- usage: pystand cache [-h] [-T] [-H] [-r] [release ...]
338
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
339
339
 
340
340
  Show size of release download caches.
341
341
 
@@ -348,6 +348,9 @@ options:
348
348
  -H, --no-human-readable
349
349
  show sizes in bytes, not human readable format
350
350
  -r, --remove remove download cache[s] instead of showing size
351
+ -R, --remove-all-unused
352
+ remove caches for all currently unused releases
353
+ instead of showing size
351
354
  ```
352
355
 
353
356
  ## Installation and Upgrade
@@ -315,7 +315,7 @@ options:
315
315
  ### Command `cache`
316
316
 
317
317
  ```
318
- usage: pystand cache [-h] [-T] [-H] [-r] [release ...]
318
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
319
319
 
320
320
  Show size of release download caches.
321
321
 
@@ -328,6 +328,9 @@ options:
328
328
  -H, --no-human-readable
329
329
  show sizes in bytes, not human readable format
330
330
  -r, --remove remove download cache[s] instead of showing size
331
+ -R, --remove-all-unused
332
+ remove caches for all currently unused releases
333
+ instead of showing size
331
334
  ```
332
335
 
333
336
  ## Installation and Upgrade
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystand
3
- Version: 2.25
3
+ Version: 2.26
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-Expression: GPL-3.0-or-later
@@ -335,7 +335,7 @@ options:
335
335
  ### Command `cache`
336
336
 
337
337
  ```
338
- usage: pystand cache [-h] [-T] [-H] [-r] [release ...]
338
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
339
339
 
340
340
  Show size of release download caches.
341
341
 
@@ -348,6 +348,9 @@ options:
348
348
  -H, --no-human-readable
349
349
  show sizes in bytes, not human readable format
350
350
  -r, --remove remove download cache[s] instead of showing size
351
+ -R, --remove-all-unused
352
+ remove caches for all currently unused releases
353
+ instead of showing size
351
354
  ```
352
355
 
353
356
  ## Installation and Upgrade
@@ -45,6 +45,7 @@ PROG = Path(__file__).stem
45
45
  DISTRIBUTIONS = {
46
46
  ('Linux', 'x86_64'): 'x86_64_v3-unknown-linux-gnu-install_only_stripped',
47
47
  ('Linux', 'aarch64'): 'aarch64-unknown-linux-gnu-install_only_stripped',
48
+ ('Linux', 'arm64'): 'aarch64-unknown-linux-gnu-install_only_stripped',
48
49
  ('Linux', 'armv7l'): 'armv7-unknown-linux-gnueabihf-install_only_stripped',
49
50
  ('Linux', 'armv8l'): 'armv7-unknown-linux-gnueabihf-install_only_stripped',
50
51
  ('Darwin', 'x86_64'): 'x86_64-apple-darwin-install_only_stripped',
@@ -52,6 +53,8 @@ DISTRIBUTIONS = {
52
53
  ('Darwin', 'arm64'): 'aarch64-apple-darwin-install_only_stripped',
53
54
  ('Windows', 'x86_64'): 'x86_64-pc-windows-msvc-shared-install_only_stripped',
54
55
  ('Windows', 'i686'): 'i686-pc-windows-msvc-shared-install_only_stripped',
56
+ ('Windows', 'aarch64'): 'aarch64-pc-windows-msvc-install_only_stripped',
57
+ ('Windows', 'arm64'): 'aarch64-pc-windows-msvc-install_only_stripped',
55
58
  }
56
59
 
57
60
  CERTS = ('system', 'certifi', 'none')
@@ -180,11 +183,11 @@ def get_gh(args: Namespace) -> Any:
180
183
  # Save this handle globally for future use
181
184
  from github import Github
182
185
 
183
- get_gh_handle = Github(auth=auth) # type: ignore
186
+ get_gh_handle = Github(auth=auth)
184
187
  return get_gh_handle
185
188
 
186
189
 
187
- def rm_path(path: Path) -> None:
190
+ def rm_path(path: Path) -> bool:
188
191
  "Remove the given path"
189
192
  if path.is_symlink():
190
193
  path.unlink()
@@ -192,6 +195,10 @@ def rm_path(path: Path) -> None:
192
195
  shutil.rmtree(path)
193
196
  elif path.exists():
194
197
  path.unlink()
198
+ else:
199
+ return False
200
+
201
+ return True
195
202
 
196
203
 
197
204
  def register_zst() -> None:
@@ -531,9 +538,8 @@ def update_version_symlinks(args: Namespace) -> None:
531
538
  (base / name).symlink_to(tgt, target_is_directory=True)
532
539
 
533
540
 
534
- def purge_unused_releases(args: Namespace) -> None:
535
- "Purge old releases that are no longer needed and have expired"
536
- # Want to keep releases for versions that we currently have installed
541
+ def keeplist(args: Namespace) -> set[str]:
542
+ "Return a set of release names to keep"
537
543
  keep = {
538
544
  r for v in iter_versions(args) if (r := get_json(v / args._data).get('release'))
539
545
  }
@@ -542,6 +548,14 @@ def purge_unused_releases(args: Namespace) -> None:
542
548
  if args._latest_release.exists():
543
549
  keep.add(args._latest_release.read_text().strip())
544
550
 
551
+ return keep
552
+
553
+
554
+ def purge_unused_releases(args: Namespace) -> None:
555
+ "Purge old releases that are no longer needed and have expired"
556
+ # Want to keep releases for versions that we currently have installed
557
+ keep = keeplist(args)
558
+
545
559
  # Purge any release lists that are no longer used and have expired
546
560
  now_secs = time.time()
547
561
  end_secs = args.purge_days * 86400
@@ -958,7 +972,10 @@ class install_:
958
972
  vdir = args._versions / version
959
973
 
960
974
  if vdir.exists() and not args.force:
961
- print(f'Version {version} is already installed.', file=sys.stderr)
975
+ print(
976
+ f'Version {args._fmtrel(version, release)} is already installed.',
977
+ file=sys.stderr,
978
+ )
962
979
  continue
963
980
 
964
981
  if error := install(args, vdir, release, args._distribution, files):
@@ -1323,40 +1340,59 @@ class cache_:
1323
1340
  action='store_true',
1324
1341
  help='show sizes in bytes, not human readable format',
1325
1342
  )
1326
- parser.add_argument(
1343
+ group = parser.add_mutually_exclusive_group()
1344
+ group.add_argument(
1327
1345
  '-r',
1328
1346
  '--remove',
1329
1347
  action='store_true',
1330
1348
  help='remove download cache[s] instead of showing size',
1331
1349
  )
1350
+ group.add_argument(
1351
+ '-R',
1352
+ '--remove-all-unused',
1353
+ action='store_true',
1354
+ help='remove caches for all currently unused releases instead of showing size',
1355
+ )
1332
1356
  parser.add_argument(
1333
1357
  'release', nargs='*', help='show cache size for given release[s] only'
1334
1358
  )
1335
1359
 
1336
1360
  @staticmethod
1337
1361
  def run(args: Namespace) -> str | None:
1338
- if args.remove:
1362
+ if args.remove_all_unused:
1339
1363
  if args.release:
1340
- for release in args.release:
1341
- rm_path(args._downloads / release)
1342
- else:
1343
- rm_path(args._downloads)
1364
+ args.parser.error(
1365
+ 'Can not specify --remove-all-unused with release names.'
1366
+ )
1344
1367
 
1345
- print('Cache removed.')
1368
+ keep = keeplist(args)
1369
+ for release in args._downloads.iterdir():
1370
+ if (name := release.name) not in keep and name.isdigit():
1371
+ if rm_path(release):
1372
+ print(f'Removed cache for release {name}.')
1346
1373
 
1347
1374
  elif args.release:
1348
1375
  for release in args.release:
1349
1376
  # Allow user to include cache path in release name
1350
1377
  path = (args._downloads / release).expanduser()
1378
+
1351
1379
  if err := check_release_tag(path.name):
1352
1380
  return err
1353
1381
 
1354
1382
  if not path.exists():
1355
1383
  return f'No cache for release {release}.'
1356
1384
 
1357
- show_cache_size(path, args)
1385
+ if args.remove:
1386
+ if rm_path(args._downloads / release):
1387
+ print(f'Removed cache for release {release.name}.')
1388
+ else:
1389
+ show_cache_size(path, args)
1358
1390
  else:
1359
- show_cache_size(args._downloads, args)
1391
+ if args.remove:
1392
+ if rm_path(args._downloads):
1393
+ print('Removed download cache.')
1394
+ else:
1395
+ show_cache_size(args._downloads, args)
1360
1396
 
1361
1397
 
1362
1398
  if __name__ == '__main__':
File without changes
File without changes
File without changes
File without changes