pystand 1.4__py3-none-any.whl → 1.6__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.6
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
@@ -99,12 +99,15 @@ $ pipx install --python $(pystand path -p 3.12) cowsay
99
99
  See detailed usage information in the [Usage](#usage) section that
100
100
  follows.
101
101
 
102
- Note that unlike nearly all similar tools such as [`pyenv`][pyenv],
103
- [`pdm python`][pdmpy], and [`hatch python`][hatchpy], `pystand` directly
104
- checks the [`python-build-standalone`][pbs] github site to fetch for new
105
- [releases][pbs-rel] but those other tools require a software update
106
- before they can see new releases. This means that Python updates are
107
- available more quickly from `pystand` than other tools.
102
+ Note that similar tools such as [`pdm python`][pdmpy], [`hatch
103
+ python`][hatchpy], and [`rye toolchain`][ryepy] also use
104
+ [`python-build-standalone`][pbs] build releases. However, `pystand` is
105
+ unique because it directly checks the [`python-build-standalone`][pbs]
106
+ github site for new [releases][pbs-rel]. Those other tools
107
+ require a software update before they can fetch and use new
108
+ [`python-build-standalone`][pbs] releases. This means that new Python
109
+ versions and updates are always available more quickly from `pystand`
110
+ than those other tools.
108
111
 
109
112
  This utility has been developed and tested on Linux but should also work
110
113
  on macOS and Windows although has not been tried on those platforms. The
@@ -118,7 +121,8 @@ Type `pystand` or `pystand -h` to view the usage summary:
118
121
  ```
119
122
  usage: pystand [-h] [-D DISTRIBUTION] [-B BASE_DIR] [-C CACHE_MINUTES]
120
123
  [--purge-days PURGE_DAYS]
121
- [--github-access-token GITHUB_ACCESS_TOKEN] [-V]
124
+ [--github-access-token GITHUB_ACCESS_TOKEN] [--do-not-strip]
125
+ [-V]
122
126
  {install,update,remove,list,show,path} ...
123
127
 
124
128
  Command line tool to download, install, and update pre-built Python versions
@@ -144,8 +148,9 @@ options:
144
148
  days after last version referencing it is removed.
145
149
  Default is 90 days
146
150
  --github-access-token GITHUB_ACCESS_TOKEN
147
- Optional Github access token. Can specify to reduce
151
+ optional Github access token. Can specify to reduce
148
152
  rate limiting.
153
+ --do-not-strip Do not strip unneeded symbols from binaries
149
154
  -V show pystand version
150
155
 
151
156
  Commands:
@@ -339,8 +344,8 @@ anything after on a line) are ignored. Type `pystand` to see all
339
344
  supported options.
340
345
 
341
346
  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.
347
+ `--purge-days`, `--github-access-token`, `--do-not-strip` are the only
348
+ sensible candidates to consider setting as defaults.
344
349
 
345
350
  ## Command Line Tab Completion
346
351
 
@@ -373,5 +378,6 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
373
378
  [pdmpy]: https://pdm-project.org/en/latest/usage/project/#install-python-interpreters-with-pdm
374
379
  [hatch]: https://hatch.pypa.io/
375
380
  [hatchpy]: https://hatch.pypa.io/latest/tutorials/python/manage/
381
+ [ryepy]: https://rye.astral.sh/guide/toolchains/#fetching-toolchains
376
382
 
377
383
  <!-- vim: se ai syn=markdown: -->
@@ -0,0 +1,6 @@
1
+ pystand.py,sha256=STdf_mHj76RKAAiMIwh2nsHh_697HuqvIa3--V9LBA0,29038
2
+ pystand-1.6.dist-info/METADATA,sha256=3fsgG6ZB_2G8UkGYkjawAYIKMC_HFiu-COc32QB1fz4,15007
3
+ pystand-1.6.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
4
+ pystand-1.6.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
+ pystand-1.6.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
+ pystand-1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.0)
2
+ Generator: setuptools (70.3.0)
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_binaries(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_binaries(tmpdir_py, distribution)
418
+
396
419
  if not error:
397
420
  remove(args, version)
398
421
  tmpdir_py.replace(vdir)
@@ -403,7 +426,7 @@ def install(args: Namespace, vdir: Path, release: str, distribution: str,
403
426
  def main() -> Optional[str]:
404
427
  'Main code'
405
428
  distro_default = DISTRIBUTIONS.get((platform.system(), platform.machine()))
406
- distro_help = distro_default if distro_default else '?unknown?'
429
+ distro_help = distro_default or '?unknown?'
407
430
 
408
431
  base_dir = Path('/opt' if is_admin() else
409
432
  platformdirs.user_data_dir()) / PROG
@@ -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', action='store_true',
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,,