Skip to content

Commit

Permalink
fix bug of sys.path
Browse files Browse the repository at this point in the history
  • Loading branch information
ClericPy committed Mar 10, 2022
1 parent 5291be2 commit 933b01f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Changelogs


- 2022.03.10
- fix bug of `sys.path` missing the parent of `__file__` while running `python venv.pyz xx.py`
- 2022.03.07
- fix bug of version `2022.03.06`
- file xxx.template not found
Expand Down
6 changes: 5 additions & 1 deletion zipapps/_entry_point.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ def main():
sys.argv = args[2:]
return run_module(args[2], run_name='__main__')
else:
if Path(arg1).is_file():
arg1_path = Path(arg1)
if arg1_path.is_file():
sys.argv = args[1:]
dir_path = arg1_path.parent
if dir_path.is_dir():
sys.path.insert(0, dir_path.absolute().as_posix())
return run_path(arg1, run_name='__main__')
else:
# python [-bBdEhiIOqsSuvVWx?]
Expand Down
2 changes: 1 addition & 1 deletion zipapps/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pkgutil import get_data
from zipfile import ZIP_DEFLATED, ZIP_STORED, BadZipFile, ZipFile

__version__ = '2022.03.07'
__version__ = '2022.03.10'


def get_pip_main(ensurepip_root=None):
Expand Down

0 comments on commit 933b01f

Please sign in to comment.