Skip to content

Commit e6dc5b3

Browse files
committed
Add CACHE_DISABLED config option to disable caching feature
1 parent e9257c3 commit e6dc5b3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mbed/mbed.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def fetch_rev(url, rev):
291291
try:
292292
if not os.path.exists(rev_file):
293293
action("Downloading library build \"%s\" (might take a minute)" % rev)
294-
outfd = open(tmp_file, 'wb')
294+
outfd = open(rev_file, 'wb')
295295
inurl = urllib2.urlopen(url)
296296
outfd.write(inurl.read())
297297
outfd.close()
@@ -849,8 +849,9 @@ def fromurl(cls, url, path=None):
849849
else:
850850
error('Invalid repository (%s)' % url.strip(), -1)
851851

852-
if cache_repositories:
853-
repo.cache = Program(repo.path).get_cfg('CACHE') or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
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')
854855

855856
return repo
856857

@@ -881,8 +882,10 @@ def fromrepo(cls, path=None):
881882

882883
repo.path = os.path.abspath(path)
883884
repo.name = os.path.basename(repo.path)
884-
if cache_repositories:
885-
repo.cache = Program(repo.path).get_cfg('CACHE') or os.path.join(tempfile.gettempdir(), 'mbed-repo-cache')
885+
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')
886889

887890
repo.sync()
888891

0 commit comments

Comments
 (0)