pystand 2.29__tar.gz → 2.30__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.29
3
+ Version: 2.30
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
@@ -349,7 +349,7 @@ aliases: p
349
349
  ### Command `cache`
350
350
 
351
351
  ```
352
- usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
352
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [-f] [release ...]
353
353
 
354
354
  Show size of release download caches.
355
355
 
@@ -365,6 +365,8 @@ options:
365
365
  -R, --remove-all-unused
366
366
  remove caches for all currently unused releases
367
367
  instead of showing size
368
+ -f, --file also remove cached release file list when removing
369
+ download caches
368
370
 
369
371
  aliases: c
370
372
  ```
@@ -330,7 +330,7 @@ aliases: p
330
330
  ### Command `cache`
331
331
 
332
332
  ```
333
- usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
333
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [-f] [release ...]
334
334
 
335
335
  Show size of release download caches.
336
336
 
@@ -346,6 +346,8 @@ options:
346
346
  -R, --remove-all-unused
347
347
  remove caches for all currently unused releases
348
348
  instead of showing size
349
+ -f, --file also remove cached release file list when removing
350
+ download caches
349
351
 
350
352
  aliases: c
351
353
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystand
3
- Version: 2.29
3
+ Version: 2.30
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
@@ -349,7 +349,7 @@ aliases: p
349
349
  ### Command `cache`
350
350
 
351
351
  ```
352
- usage: pystand cache [-h] [-T] [-H] [-r | -R] [release ...]
352
+ usage: pystand cache [-h] [-T] [-H] [-r | -R] [-f] [release ...]
353
353
 
354
354
  Show size of release download caches.
355
355
 
@@ -365,6 +365,8 @@ options:
365
365
  -R, --remove-all-unused
366
366
  remove caches for all currently unused releases
367
367
  instead of showing size
368
+ -f, --file also remove cached release file list when removing
369
+ download caches
368
370
 
369
371
  aliases: c
370
372
  ```
@@ -1398,12 +1398,21 @@ class cache_:
1398
1398
  action='store_true',
1399
1399
  help='remove caches for all currently unused releases instead of showing size',
1400
1400
  )
1401
+ parser.add_argument(
1402
+ '-f',
1403
+ '--file',
1404
+ action='store_true',
1405
+ help='also remove cached release file list when removing download caches',
1406
+ )
1401
1407
  parser.add_argument(
1402
1408
  'release', nargs='*', help='show cache size for given release[s] only'
1403
1409
  )
1404
1410
 
1405
1411
  @staticmethod
1406
1412
  def run(args: Namespace) -> str | None:
1413
+ if args.file and not (args.remove or args.remove_all_unused):
1414
+ args.parser.error('The -f/--file option only applies when removing.')
1415
+
1407
1416
  if args.remove_all_unused:
1408
1417
  if args.release:
1409
1418
  args.parser.error(
@@ -1411,31 +1420,49 @@ class cache_:
1411
1420
  )
1412
1421
 
1413
1422
  keep = keeplist(args)
1414
- for release in args._downloads.iterdir():
1415
- if (name := release.name) not in keep and name.isdigit():
1416
- if rm_path(release):
1417
- print(f'Removed cache for release {name}.')
1423
+ releases = set(
1424
+ p.name for p in args._downloads.iterdir() if p.name.isdigit()
1425
+ )
1426
+ releases.update(
1427
+ p.name for p in args._releases.iterdir() if p.name.isdigit()
1428
+ )
1429
+ for release in sorted(releases):
1430
+ if release not in keep:
1431
+ if rm_path(args._downloads / release):
1432
+ print(f'Removed download cache for release {release}.')
1433
+ if args.file and rm_path(args._releases / release):
1434
+ print(f'Removed file list cache for release {release}.')
1418
1435
 
1419
1436
  elif args.release:
1420
1437
  for release in args.release:
1421
1438
  # Allow user to include cache path in release name
1422
1439
  path = (args._downloads / release).expanduser()
1440
+ release = path.name
1423
1441
 
1424
- if err := check_release_tag(path.name):
1442
+ if err := check_release_tag(release):
1425
1443
  return err
1426
1444
 
1427
- if not path.exists():
1428
- return f'No cache for release {release}.'
1429
-
1430
1445
  if args.remove:
1431
- if rm_path(args._downloads / release):
1432
- print(f'Removed cache for release {release.name}.')
1446
+ removed = False
1447
+ if rm_path(path):
1448
+ print(f'Removed download cache for release {release}.')
1449
+ removed = True
1450
+
1451
+ if args.file and rm_path((args._releases / release).expanduser()):
1452
+ print(f'Removed file list cache for release {release}.')
1453
+ removed = True
1454
+
1455
+ if not removed:
1456
+ print(f'No caches found for release {release}.')
1457
+
1433
1458
  else:
1434
1459
  show_cache_size(path, args)
1435
1460
  else:
1436
1461
  if args.remove:
1437
1462
  if rm_path(args._downloads):
1438
1463
  print('Removed download cache.')
1464
+ if args.file and rm_path(args._releases):
1465
+ print('Removed file lists cache.')
1439
1466
  else:
1440
1467
  show_cache_size(args._downloads, args)
1441
1468
 
File without changes
File without changes
File without changes
File without changes