pystand 1.4__tar.gz → 1.6__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.
@@ -19,4 +19,4 @@ doc:
19
19
  update-readme-usage
20
20
 
21
21
  clean:
22
- @rm -vrf *.egg-info .venv/ build/ dist/ __pycache__ */__pycache__
22
+ @rm -vrf *.egg-info .venv/ build/ dist/ __pycache__
@@ -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: -->
@@ -83,12 +83,15 @@ $ pipx install --python $(pystand path -p 3.12) cowsay
83
83
  See detailed usage information in the [Usage](#usage) section that
84
84
  follows.
85
85
 
86
- Note that unlike nearly all similar tools such as [`pyenv`][pyenv],
87
- [`pdm python`][pdmpy], and [`hatch python`][hatchpy], `pystand` directly
88
- checks the [`python-build-standalone`][pbs] github site to fetch for new
89
- [releases][pbs-rel] but those other tools require a software update
90
- before they can see new releases. This means that Python updates are
91
- available more quickly from `pystand` than other tools.
86
+ Note that similar tools such as [`pdm python`][pdmpy], [`hatch
87
+ python`][hatchpy], and [`rye toolchain`][ryepy] also use
88
+ [`python-build-standalone`][pbs] build releases. However, `pystand` is
89
+ unique because it directly checks the [`python-build-standalone`][pbs]
90
+ github site for new [releases][pbs-rel]. Those other tools
91
+ require a software update before they can fetch and use new
92
+ [`python-build-standalone`][pbs] releases. This means that new Python
93
+ versions and updates are always available more quickly from `pystand`
94
+ than those other tools.
92
95
 
93
96
  This utility has been developed and tested on Linux but should also work
94
97
  on macOS and Windows although has not been tried on those platforms. The
@@ -102,7 +105,8 @@ Type `pystand` or `pystand -h` to view the usage summary:
102
105
  ```
103
106
  usage: pystand [-h] [-D DISTRIBUTION] [-B BASE_DIR] [-C CACHE_MINUTES]
104
107
  [--purge-days PURGE_DAYS]
105
- [--github-access-token GITHUB_ACCESS_TOKEN] [-V]
108
+ [--github-access-token GITHUB_ACCESS_TOKEN] [--do-not-strip]
109
+ [-V]
106
110
  {install,update,remove,list,show,path} ...
107
111
 
108
112
  Command line tool to download, install, and update pre-built Python versions
@@ -128,8 +132,9 @@ options:
128
132
  days after last version referencing it is removed.
129
133
  Default is 90 days
130
134
  --github-access-token GITHUB_ACCESS_TOKEN
131
- Optional Github access token. Can specify to reduce
135
+ optional Github access token. Can specify to reduce
132
136
  rate limiting.
137
+ --do-not-strip Do not strip unneeded symbols from binaries
133
138
  -V show pystand version
134
139
 
135
140
  Commands:
@@ -323,8 +328,8 @@ anything after on a line) are ignored. Type `pystand` to see all
323
328
  supported options.
324
329
 
325
330
  The global options: `--distribution`, `--base-dir`, `--cache-minutes`,
326
- `--purge-days`, `--github-access-token` are the only sensible candidates
327
- to consider setting as defaults.
331
+ `--purge-days`, `--github-access-token`, `--do-not-strip` are the only
332
+ sensible candidates to consider setting as defaults.
328
333
 
329
334
  ## Command Line Tab Completion
330
335
 
@@ -357,5 +362,6 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
357
362
  [pdmpy]: https://pdm-project.org/en/latest/usage/project/#install-python-interpreters-with-pdm
358
363
  [hatch]: https://hatch.pypa.io/
359
364
  [hatchpy]: https://hatch.pypa.io/latest/tutorials/python/manage/
365
+ [ryepy]: https://rye.astral.sh/guide/toolchains/#fetching-toolchains
360
366
 
361
367
  <!-- vim: se ai syn=markdown: -->
@@ -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: -->
@@ -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')
File without changes
File without changes
File without changes
File without changes