Skip to content

Commit

Permalink
properly reference ".pexrc" as relative to the pex file itself.
Browse files Browse the repository at this point in the history
  • Loading branch information
lorencarvalho committed Jun 23, 2015
1 parent 133bfac commit 10d215e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pex/variables.py
Expand Up @@ -5,6 +5,7 @@
# checkstyle: noqa

import os
import sys
from contextlib import contextmanager

from .common import die
Expand Down Expand Up @@ -47,15 +48,14 @@ def set(self, variable, value):

def _from_rc(self, rc):
ret_vars = {}
for filename in [rc, '.pexrc']:
for filename in [rc, os.path.join(os.path.dirname(sys.argv[0]), '.pexrc')]:
try:
with open(os.path.expanduser(filename)) as fh:
ret_vars.update(dict(map(lambda x: x.strip().split('='), fh)))
except IOError:
continue
return ret_vars


def _get_bool(self, variable, default=False):
value = self._environ.get(variable)
if value is not None:
Expand Down

0 comments on commit 10d215e

Please sign in to comment.