Skip to content

Commit

Permalink
Add doctest for _build_env; ref #72.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 24, 2023
1 parent 6c7b0de commit e86b22c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pip_run/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ def _path_insert(previous, value):
def _build_env(target, *, orig=os.environ):
"""
Prepend target to PYTHONPATH and add $target/bin to PATH.
>>> import pprint
>>> orig = dict(PYTHONPATH='/orig', PATH='/orig')
>>> pprint.pprint(_build_env(pathlib.Path('/tmp/pip-run/target'), orig=orig))
{'PATH': '/tmp/pip-run/target/bin:/orig',
'PYTHONPATH': '/tmp/pip-run/target:/orig'}
"""
overlay = dict(
PYTHONPATH=_path_insert(orig.get('PYTHONPATH', ''), os.fspath(target)),
Expand Down

0 comments on commit e86b22c

Please sign in to comment.