Skip to content

Commit 54753ad

Browse files
committed
Disable caching via mbed config cache off or mbed config cache none than a separate variable
1 parent 8536d5d commit 54753ad

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ Here is a list of currently implemented configuration settings:
781781
* `ARM_PATH`, `GCC_ARM_PATH`, `IAR_PATH` - defines the default path to ARM Compiler, GCC ARM and IAR Workbench toolchains. Default: none.
782782
* `protocol` - defines the default protocol used for importing or cloning of programs and libraries. The possible values are `https`, `http` and `ssh`. Use `ssh` if you have generated and registered SSH keys (Public Key Authentication) with a service like GitHub, GitLab, Bitbucket, etc. Read more about SSH keys [here](https://help.github.com/articles/generating-an-ssh-key/) Default: `https`.
783783
* `depth` - defines the *clone* depth for importing or cloning and applies only to *Git* repositories. Note that while this option may improve cloning speed, it may also prevent you from correctly checking out a dependency tree when the reference revision hash is older than the clone depth. Read more about shallow clones [here](https://git-scm.com/docs/git-clone). Default: none.
784-
* `cache` - defines the local path that will be used to store minimalistic copies of the imported or cloned repositories, and attempts to use them to minimize traffic and speed up future importing. Default: none (system temp path).
785-
* `cache_disabled` - disables the caching functionality. Default: none.
784+
* `cache` - defines the local path that will be used to store minimalistic copies of the imported or cloned repositories, and attempts to use them to minimize traffic and speed up future importing. Will disable caching if set to "off" or "none". Default: system temp path.
786785

787786
## Troubleshooting
788787

mbed/mbed.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,10 @@ def fromurl(cls, url, path=None):
849849
else:
850850
error('Invalid repository (%s)' % url.strip(), -1)
851851

852-
g = Global()
853-
if cache_repositories and not g.get_cfg('CACHE_DISABLED'):
854-
repo.cache = g.get_cfg('CACHE') or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
852+
cache_cfg = Global().get_cfg('CACHE', '')
853+
if cache_repositories and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
854+
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled') else None
855+
repo.cache = loc or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
855856

856857
return repo
857858

@@ -883,9 +884,10 @@ def fromrepo(cls, path=None):
883884
repo.path = os.path.abspath(path)
884885
repo.name = os.path.basename(repo.path)
885886

886-
g = Global()
887-
if cache_repositories and not g.get_cfg('CACHE_DISABLED'):
888-
repo.cache = g.get_cfg('CACHE') or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
887+
cache_cfg = Global().get_cfg('CACHE', '')
888+
if cache_repositories and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
889+
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled') else None
890+
repo.cache = loc or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
889891

890892
repo.sync()
891893

0 commit comments

Comments
 (0)