Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default sys.path injected into PYTHONPATH #229

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

[metadata]
name = shiv
version = 1.0.2
version = 1.0.3
description = A command line utility for building fully self contained Python zipapps.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
10 changes: 8 additions & 2 deletions src/shiv/bootstrap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,26 @@ def bootstrap(): # pragma: no cover
# Find the first instance of an existing site-packages on sys.path
index = get_first_sitedir_index() or length

# copy sys.path to determine diff
sys_path_before = sys.path.copy()

# append site-packages using the stdlib blessed way of extending path
# so as to handle .pth files correctly
site.addsitedir(site_packages)

# reorder to place our site-packages before any others found
sys.path = sys.path[:index] + sys.path[length:] + sys.path[index:length]

# determine newly added paths
new_paths = [p for p in sys.path if p not in sys_path_before]

# check if source files have been modified, if required
if env.no_modify:
ensure_no_modify(site_packages, env.hashes)

# add our site-packages to the environment, if requested
# add any new paths to the environment, if requested
if env.extend_pythonpath:
extend_python_path(os.environ, sys.path.copy())
extend_python_path(os.environ, new_paths)

# if a preamble script was provided, run it
if env.preamble:
Expand Down
2 changes: 1 addition & 1 deletion src/shiv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
SOURCE_DATE_EPOCH_ENV,
)

__version__ = "1.0.2"
__version__ = "1.0.3"


def find_entry_point(site_packages_dirs: List[Path], console_script: str) -> str:
Expand Down