diff --git a/pex/bin/pex.py b/pex/bin/pex.py old mode 100755 new mode 100644 diff --git a/pex/cache/root.py b/pex/cache/root.py index 8793b7e1e..c624de107 100644 --- a/pex/cache/root.py +++ b/pex/cache/root.py @@ -14,8 +14,10 @@ from pex.third_party import appdirs -_USER_DIR = os.path.expanduser("~") -_CACHE_DIR = appdirs.user_cache_dir(appauthor="pex-tool.org", appname="pex") # type: str +_USER_DIR = os.path.realpath(os.path.expanduser("~")) +_CACHE_DIR = os.path.realpath( + appdirs.user_cache_dir(appauthor="pex-tool.org", appname="pex") +) # type: str def path(expand_user=True): diff --git a/pex/pex_info.py b/pex/pex_info.py index dbc07bdd3..9a8024326 100644 --- a/pex/pex_info.py +++ b/pex/pex_info.py @@ -507,7 +507,7 @@ def raw_pex_root(self): @property def pex_root(self): # type: () -> str - pex_root = os.path.expanduser(self.raw_pex_root) + pex_root = os.path.realpath(os.path.expanduser(self.raw_pex_root)) if not can_write_dir(pex_root): tmp_root = safe_mkdtemp() pex_warnings.warn( diff --git a/pex/variables.py b/pex/variables.py index 43ffdebfe..b22f041ad 100644 --- a/pex/variables.py +++ b/pex/variables.py @@ -167,7 +167,7 @@ def _default_pex_root(): # third party import lifecycle events. from pex.cache import root as cache_root - return cache_root.path(expand_user=False) + return cache_root.path(expand_user=True) class Variables(object): @@ -796,7 +796,7 @@ def __repr__(self): # calculations: https://github.com/pex-tool/pex/issues/1154 def _expand_pex_root(pex_root): # type: (str) -> str - fallback = os.path.expanduser(pex_root) + fallback = os.path.realpath(os.path.expanduser(pex_root)) return os.path.expanduser(Variables.PEX_ROOT.value_or(ENV, fallback=fallback))