summaryrefslogtreecommitdiff
path: root/src/engine/SCons/CacheDir.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/CacheDir.py')
-rw-r--r--src/engine/SCons/CacheDir.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py
index 8815eb3..73df784 100644
--- a/src/engine/SCons/CacheDir.py
+++ b/src/engine/SCons/CacheDir.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,12 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/CacheDir.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/CacheDir.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog"
__doc__ = """
CacheDir support
"""
+import hashlib
import json
import os
import stat
@@ -55,6 +56,10 @@ def CacheRetrieveFunc(target, source, env):
fs.symlink(fs.readlink(cachefile), t.get_internal_path())
else:
env.copy_from_cache(cachefile, t.get_internal_path())
+ try:
+ os.utime(cachefile, None)
+ except OSError:
+ pass
st = fs.stat(cachefile)
fs.chmod(t.get_internal_path(), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
return 0
@@ -134,12 +139,6 @@ warned = dict()
class CacheDir(object):
def __init__(self, path):
- try:
- import hashlib
- except ImportError:
- msg = "No hashlib or MD5 module available, CacheDir() not supported"
- SCons.Warnings.warn(SCons.Warnings.NoMD5ModuleWarning, msg)
- path = None
self.path = path
self.current_cache_debug = None
self.debugFP = None
@@ -222,7 +221,9 @@ class CacheDir(object):
return None, None
sig = node.get_cachedir_bsig()
+
subdir = sig[:self.config['prefix_len']].upper()
+
dir = os.path.join(self.path, subdir)
return dir, os.path.join(dir, sig)