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

Replace use of os.unsetenv(...) with del os.environ[...] #11

Merged
merged 1 commit into from
Nov 21, 2014
Merged
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
11 changes: 7 additions & 4 deletions pex/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ def start_coverage(cls):

@classmethod
def clean_environment(cls, forking=False):
os.unsetenv('MACOSX_DEPLOYMENT_TARGET')
try:
del os.environ['MACOSX_DEPLOYMENT_TARGET']
except KeyError:
pass
if not forking:
for key in filter(lambda key: key.startswith('PEX_'), os.environ):
os.unsetenv(key)
del os.environ[key]

def __init__(self, pex=sys.argv[0], interpreter=None):
self._pex = pex
Expand Down Expand Up @@ -241,8 +244,8 @@ def execute(self, args=()):
@classmethod
def execute_interpreter(cls):
force_interpreter = 'PEX_INTERPRETER' in os.environ
# TODO(wickman) Apparently os.unsetenv doesn't work on Windows
os.unsetenv('PEX_INTERPRETER')
if force_interpreter:
del os.environ['PEX_INTERPRETER']
TRACER.log('%s, dropping into interpreter' % (
'PEX_INTERPRETER specified' if force_interpreter else 'No entry point specified'))
if sys.argv[1:]:
Expand Down