diff --git a/setup.cfg b/setup.cfg index 400e676..4b9cc3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/src/shiv/bootstrap/__init__.py b/src/shiv/bootstrap/__init__.py index 4542952..6f0c584 100644 --- a/src/shiv/bootstrap/__init__.py +++ b/src/shiv/bootstrap/__init__.py @@ -208,6 +208,9 @@ 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) @@ -215,13 +218,16 @@ def bootstrap(): # pragma: no cover # 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: diff --git a/src/shiv/cli.py b/src/shiv/cli.py index 758e83e..f361091 100644 --- a/src/shiv/cli.py +++ b/src/shiv/cli.py @@ -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: