You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove automatic fallback to $HOME/.emscripten_cache. NFC (#22801)
Putting the cache in the `$HOME` directory is not a great idea since its
a location that is shared by any/all versions of emscripten. If anyone
really wants to use that location they can do so via the config file
setting `CACHE` or via the environment variable `EMCC_CACHE`.
Copy file name to clipboardExpand all lines: tools/cache.py
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,13 +23,20 @@
23
23
cachelock_name=None
24
24
25
25
26
+
defis_writable(path):
27
+
returnos.access(path, os.W_OK)
28
+
29
+
26
30
defacquire_cache_lock(reason):
27
31
globalacquired_count
28
32
ifconfig.FROZEN_CACHE:
29
33
# Raise an exception here rather than exit_with_error since in practice this
30
34
# should never happen
31
35
raiseException('Attempt to lock the cache but FROZEN_CACHE is set')
32
36
37
+
ifnotis_writable(cachedir):
38
+
utils.exit_with_error(f'cache directory "{cachedir}" is not writable while accessing cache for: {reason} (see https://emscripten.org/docs/tools_reference/emcc.html for info on setting the cache directory)')
39
+
33
40
ifacquired_count==0:
34
41
logger.debug(f'PID {os.getpid()} acquiring multiprocess file lock to Emscripten cache at {cachedir}')
35
42
assert'EM_CACHE_IS_LOCKED'notinos.environ, f'attempt to lock the cache while a parent process is holding the lock ({reason})'
@@ -67,7 +74,11 @@ def lock(reason):
67
74
68
75
defensure():
69
76
ensure_setup()
70
-
utils.safe_ensure_dirs(cachedir)
77
+
ifnotos.path.isdir(cachedir):
78
+
parent_dir=os.path.dirname(cachedir)
79
+
ifnotis_writable(parent_dir):
80
+
utils.exit_with_error('unable to create cache directory "{cachdir}": parent directory not writable (see https://emscripten.org/docs/tools_reference/emcc.html for info on setting the cache directory)')
0 commit comments