mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
cache scripts by realpath
Cache scripts by realpath, resolving symlinks, as per discussion in #2776. I chose realpath(...) over abspath(realpath(...)), as realpath does call abspath internally.
This commit is contained in:
parent
a74169b45b
commit
0a9899a7cf
2 changed files with 14 additions and 1 deletions
13
news/cache-by-realpath.rst
Normal file
13
news/cache-by-realpath.rst
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
**Added:** None
|
||||||
|
|
||||||
|
**Changed:** None
|
||||||
|
|
||||||
|
**Deprecated:** None
|
||||||
|
|
||||||
|
**Removed:** None
|
||||||
|
|
||||||
|
**Fixed:**
|
||||||
|
|
||||||
|
* Scripts are now cached by their realpath, not just abspath.
|
||||||
|
|
||||||
|
**Security:** None
|
|
@ -29,7 +29,7 @@ def _CHARACTER_MAP():
|
||||||
|
|
||||||
def _cache_renamer(path, code=False):
|
def _cache_renamer(path, code=False):
|
||||||
if not code:
|
if not code:
|
||||||
path = os.path.abspath(path)
|
path = os.path.realpath(path)
|
||||||
o = [''.join(_CHARACTER_MAP.get(i, i) for i in w) for w in _splitpath(path)]
|
o = [''.join(_CHARACTER_MAP.get(i, i) for i in w) for w in _splitpath(path)]
|
||||||
o[-1] = "{}.{}".format(o[-1], sys.implementation.cache_tag)
|
o[-1] = "{}.{}".format(o[-1], sys.implementation.cache_tag)
|
||||||
return o
|
return o
|
||||||
|
|
Loading…
Add table
Reference in a new issue