pystand 1.4__py3-none-any.whl → 1.5__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: 1.4
3
+ Version: 1.5
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
@@ -118,7 +118,8 @@ Type `pystand` or `pystand -h` to view the usage summary:
118
118
  ```
119
119
  usage: pystand [-h] [-D DISTRIBUTION] [-B BASE_DIR] [-C CACHE_MINUTES]
120
120
  [--purge-days PURGE_DAYS]
121
- [--github-access-token GITHUB_ACCESS_TOKEN] [-V]
121
+ [--github-access-token GITHUB_ACCESS_TOKEN]
122
+ [--do-not-strip DO_NOT_STRIP] [-V]
122
123
  {install,update,remove,list,show,path} ...
123
124
 
124
125
  Command line tool to download, install, and update pre-built Python versions
@@ -144,8 +145,10 @@ options:
144
145
  days after last version referencing it is removed.
145
146
  Default is 90 days
146
147
  --github-access-token GITHUB_ACCESS_TOKEN
147
- Optional Github access token. Can specify to reduce
148
+ optional Github access token. Can specify to reduce
148
149
  rate limiting.
150
+ --do-not-strip DO_NOT_STRIP
151
+ Do not strip unneeded symbols from binaries
149
152
  -V show pystand version
150
153
 
151
154
  Commands:
@@ -339,8 +342,8 @@ anything after on a line) are ignored. Type `pystand` to see all
339
342
  supported options.
340
343
 
341
344
  The global options: `--distribution`, `--base-dir`, `--cache-minutes`,
342
- `--purge-days`, `--github-access-token` are the only sensible candidates
343
- to consider setting as defaults.
345
+ `--purge-days`, `--github-access-token`, `--do-not-strip` are the only
346
+ sensible candidates to consider setting as defaults.
344
347
 
345
348
  ## Command Line Tab Completion
346
349
 
@@ -0,0 +1,6 @@
1
+ pystand.py,sha256=L0SAV5snhVrNrhFWTb4xuLHp3Mr5eNYF6ke_AWdxtq0,29019
2
+ pystand-1.5.dist-info/METADATA,sha256=j9q9s0eDv4reAYspvONxUrFvduSaeef8tFx9IzEfVaQ,14843
3
+ pystand-1.5.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
4
+ pystand-1.5.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
+ pystand-1.5.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
+ pystand-1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.0)
2
+ Generator: setuptools (70.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pystand.py CHANGED
@@ -13,6 +13,7 @@ import platform
13
13
  import re
14
14
  import shlex
15
15
  import shutil
16
+ import subprocess
16
17
  import sys
17
18
  import time
18
19
  import urllib.request
@@ -367,6 +368,25 @@ def remove(args: Namespace, version: str) -> None:
367
368
 
368
369
  shutil.rmtree(vdir)
369
370
 
371
+ def strip(vdir: Path, distribution: str) -> None:
372
+ 'Strip binaries from files in a version directory'
373
+ # Only run the strip command on Linux hosts and for Linux distributions
374
+ if platform.system() != 'Linux' or '-linux-' not in distribution:
375
+ return
376
+
377
+ for path in ('bin', 'lib'):
378
+ base = vdir / path
379
+ if not base.is_dir():
380
+ continue
381
+
382
+ for file in base.iterdir():
383
+ if not file.is_symlink() and file.is_file():
384
+ cmd = f'strip -p --strip-unneeded {file}'.split()
385
+ try:
386
+ subprocess.run(cmd, stderr=subprocess.DEVNULL)
387
+ except Exception:
388
+ pass
389
+
370
390
  def install(args: Namespace, vdir: Path, release: str, distribution: str,
371
391
  files: dict) -> Optional[str]:
372
392
  'Install a version'
@@ -393,6 +413,9 @@ def install(args: Namespace, vdir: Path, release: str, distribution: str,
393
413
  if (error := set_json(tmpdir_py / args._data, data)):
394
414
  error = f'Failed to write {version} data file: {error}'
395
415
 
416
+ if not args.do_not_strip:
417
+ strip(tmpdir_py, distribution)
418
+
396
419
  if not error:
397
420
  remove(args, version)
398
421
  tmpdir_py.replace(vdir)
@@ -431,8 +454,10 @@ def main() -> Optional[str]:
431
454
  'of days after last version referencing it is removed. '
432
455
  'Default is %(default)d days')
433
456
  opt.add_argument('--github-access-token',
434
- help='Optional Github access token. Can specify to reduce '
457
+ help='optional Github access token. Can specify to reduce '
435
458
  'rate limiting.')
459
+ opt.add_argument('--do-not-strip',
460
+ help='Do not strip unneeded symbols from binaries')
436
461
  opt.add_argument('-V', action='store_true',
437
462
  help=f'show {PROG} version')
438
463
  cmd = opt.add_subparsers(title='Commands', dest='cmdname')
@@ -1,6 +0,0 @@
1
- pystand.py,sha256=ZwryYWIROt0rscb3vQTx9uE8eZus4x7iUOhHeJBC3SA,28134
2
- pystand-1.4.dist-info/METADATA,sha256=D-nGRE3vUfZFEJb-NsD74DgROuSzM2E_kcbmBQVvNBc,14679
3
- pystand-1.4.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
4
- pystand-1.4.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
- pystand-1.4.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
- pystand-1.4.dist-info/RECORD,,