Skip to content

Commit 1ad381e

Browse files
author
lidong
committed
update sys_paths default insert index; update download_python
1 parent daf5e90 commit 1ad381e

File tree

7 files changed

+201
-88
lines changed

7 files changed

+201
-88
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# [zipapps](https://github.com/ClericPy/zipapps)
22

3-
[![PyPI](https://img.shields.io/pypi/v/zipapps?style=plastic)](https://pypi.org/project/zipapps/)[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/clericpy/zipapps/pythonpackage.yml)](https://github.com/ClericPy/zipapps/actions)![PyPI - Wheel](https://img.shields.io/pypi/wheel/zipapps?style=plastic)![PyPI - Downloads](https://img.shields.io/pypi/dm/zipapps?style=plastic)![PyPI - License](https://img.shields.io/pypi/l/zipapps?style=plastic)
3+
[![PyPI](https://img.shields.io/pypi/v/zipapps?style=plastic)](https://pypi.org/project/zipapps/)[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/clericpy/zipapps/pythonpackage.yml)](https://github.com/ClericPy/zipapps/actions)![PyPI - Wheel](https://img.shields.io/pypi/wheel/zipapps?style=plastic)![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=zipapps)![PyPI - Downloads](https://img.shields.io/pypi/dm/zipapps?style=plastic)![PyPI - License](https://img.shields.io/pypi/l/zipapps?style=plastic)
44

55
[Changelogs](https://github.com/ClericPy/zipapps/blob/master/changelog.md)
66

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11

22
# Changelogs
33

4+
- 2024.08.07
5+
- [**Compatible WARNING**]: update `sys_paths` insert index from `-1` to `0`
6+
- disable `--download-python`, use `python -m zipapps.download_python` instead
7+
- add `-a/--auto`
8+
- auto download the latest version matched the current platform: x86_64+install_only
9+
- `python -m zipapps.download_python -a`
10+
- add `-k/--keywords`, filt with keywords split by `,`
11+
- `python -m zipapps.download_python -a -k 3.11`
12+
- add `-u/--unzip`, unzip the `.tar.gz`
13+
- `python -m zipapps.download_python -a -k 3.11 -u`
14+
- download and unzip the `.tar.gz`
415
- 2024.06.04
516
- add arg `--download-python`: interactive download standalone python interpreter (https://www.github.com/indygreg/python-build-standalone)
617
- custom `--rm-patterns` to remove useless files . fixed #28 #29

test_utils.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,19 @@ def test_includes():
310310
def test_pip_args():
311311
# test pip_args
312312
_clean_paths()
313-
_, stderr_output = subprocess.Popen(
314-
[sys.executable, "-c", "import bottle"],
313+
stdout, _ = subprocess.Popen(
314+
[sys.executable, "-c", "import bottle;print(bottle.__file__)"],
315315
stderr=subprocess.PIPE,
316316
stdout=subprocess.PIPE,
317317
).communicate()
318-
assert (
319-
b"No module named" in stderr_output
320-
), "check init failed, bottle should not be installed"
318+
assert b'app.pyz' not in stdout, "test pip_args failed %s" % stdout
321319
app_path = create_app(pip_args=["bottle"])
322-
_, stderr_output = subprocess.Popen(
323-
[sys.executable, str(app_path), "-c", "import bottle"],
320+
stdout, _ = subprocess.Popen(
321+
[sys.executable, str(app_path), "-c", "import bottle;print(bottle.__file__)"],
324322
stderr=subprocess.PIPE,
325323
stdout=subprocess.PIPE,
326324
).communicate()
327-
assert stderr_output == b"", "test pip_args failed"
325+
assert b'app.pyz' in stdout, "test pip_args failed %s" % stdout
328326

329327

330328
def test_cache_path():
@@ -626,8 +624,6 @@ def test_sys_paths():
626624
# pip install by given --target
627625
args = [sys.executable, "-m", "pip", "install", "bottle", "-t", "./bottle_env"]
628626
subprocess.Popen(args=args).wait()
629-
mock_requirement = Path("_requirements.txt")
630-
mock_requirement.write_text("bottle")
631627
create_app(sys_paths="$SELF/bottle_env")
632628
output = subprocess.check_output(
633629
[sys.executable, "app.pyz", "-c", "import bottle;print(bottle.__file__)"]

zipapps/__main__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def main():
304304
"--python-path",
305305
default="",
306306
dest="sys_paths",
307-
help="Paths be insert to sys.path[-1] while running."
307+
help="Paths be insert to sys.path[0] while running."
308308
" Support $TEMP/$HOME/$SELF/$PID/$CWD prefix, separated by commas.",
309309
)
310310
parser.add_argument(
@@ -395,7 +395,7 @@ def main():
395395
"--download-python",
396396
action="store_true",
397397
dest="download_python",
398-
help=f'Download standalone python from "{DOWNLOAD_PYTHON_URL}"',
398+
help=f'(please use `python -m zipapps.download_python` instead). Download standalone python from "{DOWNLOAD_PYTHON_URL}"',
399399
)
400400
parser.add_argument(
401401
"--rm-patterns",
@@ -409,9 +409,7 @@ def main():
409409
return
410410
args, pip_args = parser.parse_known_args()
411411
if args.download_python:
412-
from .download_python import download_python
413-
414-
return download_python()
412+
raise ValueError("please use `python -m zipapps.download_python` instead")
415413
elif args.download_pip_pyz:
416414
return download_pip_pyz(args.download_pip_pyz)
417415
if args.quite_mode:

0 commit comments

Comments
 (0)