Skip to content

Commit fdbd8d0

Browse files
committed
Disable cache by default, enable it by mbed config -G cache on
1 parent 54753ad commit fdbd8d0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +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. Will disable caching if set to "off" or "none". Default: system temp path.
784+
* `cache` - defines the local path that will be used to store minimalistic copies of the imported or cloned repositories, and attempts to use it to minimize traffic and speed up future imports of the same repositories. Use `on` or `enabled` to turn on caching in the system temp path. Default: none (disabled).
785785

786786
## Troubleshooting
787787

mbed/mbed.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ def fromurl(cls, url, path=None):
850850
error('Invalid repository (%s)' % url.strip(), -1)
851851

852852
cache_cfg = Global().get_cfg('CACHE', '')
853-
if cache_repositories and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
853+
if cache_repositories and cache_cfg and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
854854
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled') else None
855855
repo.cache = loc or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
856856

@@ -885,7 +885,7 @@ def fromrepo(cls, path=None):
885885
repo.name = os.path.basename(repo.path)
886886

887887
cache_cfg = Global().get_cfg('CACHE', '')
888-
if cache_repositories and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
888+
if cache_repositories and cache_cfg and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
889889
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled') else None
890890
repo.cache = loc or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
891891

@@ -1203,7 +1203,7 @@ def __init__(self, path=None, print_warning=False):
12031203
if self.is_cwd and print_warning:
12041204
warning(
12051205
"Could not find mbed program in current path \"%s\".\n"
1206-
"You can fix this by calling \"mbed new .\" or \"mbed config root .\" in the root of your program." % self.path)
1206+
"You can fix this by calling \"mbed new .\" in the root of your program." % self.path)
12071207

12081208
def get_cfg(self, *args, **kwargs):
12091209
return Cfg(self.path).get(*args, **kwargs) or Global().get_cfg(*args, **kwargs)
@@ -2379,6 +2379,10 @@ def config_(var=None, value=None, global_cfg=False, unset=False, list_config=Fal
23792379
else:
23802380
# Find the root of the program
23812381
program = Program(os.getcwd())
2382+
if program.is_cwd:
2383+
error(
2384+
"Could not find mbed program in current path \"%s\".\n"
2385+
"Change the current directory to a valid mbed program or use the '--global' option to set global configuration." % program.path)
23822386
with cd(program.path):
23832387
if unset:
23842388
program.set_cfg(var, None)

0 commit comments

Comments
 (0)