Skip to content

Commit

Permalink
Merge pull request #680 from screamerbg/f/new-mbed2-programs
Browse files Browse the repository at this point in the history
Fix mbed2 builds download when creating new mbed2 program
  • Loading branch information
theotherjimmy authored May 29, 2018
2 parents 4f24ce5 + a7f3fa6 commit 502fa9c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mbed/mbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ def clone(url, path=None, depth=None, protocol=None):
try:
Bld.init(path)
with cd(path):
Bld.seturl(url+'/tip')
rev = Hg.remoteid(m.group(1), 'tip')
if not rev:
error("Unable to fetch library build information")
Bld.seturl(url+'/'+rev)
except Exception as e:
if os.path.isdir(path):
rmtree_readonly(path)
Expand All @@ -363,7 +366,7 @@ def fetch_rev(url, rev):
rev_file = os.path.join('.'+Bld.name, '.rev-' + rev + '.zip')
try:
if not os.path.exists(rev_file):
action("Downloading library build \"%s\" (might take a minute)" % rev)
action("Downloading library build \"%s\" (might take a while)" % rev)
outfd = open(rev_file, 'wb')
inurl = urlopen(url)
outfd.write(inurl.read())
Expand Down Expand Up @@ -1008,7 +1011,7 @@ def fromurl(cls, url, path=None):
repo.path = os.path.abspath(path or os.path.join(getcwd(), repo.name))
repo.url = formaturl(m_repo_ref.group(1))
repo.rev = m_repo_ref.group(3)
if repo.rev and repo.rev != 'latest' and not re.match(r'^([a-fA-F0-9]{6,40})$', repo.rev):
if repo.rev and repo.rev != 'latest' and repo.rev != 'tip' and not re.match(r'^([a-fA-F0-9]{6,40})$', repo.rev):
error('Invalid revision (%s)' % repo.rev, -1)
else:
error('Invalid repository (%s)' % url.strip(), -1)
Expand Down Expand Up @@ -1927,7 +1930,7 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
p.path = cwd_root
p.set_root()
if not create_only and not p.get_os_dir() and not p.get_mbedlib_dir():
url = mbed_lib_url if mbedlib else mbed_os_url+'#latest'
url = mbed_lib_url+'#tip' if mbedlib else mbed_os_url+'#latest'
d = 'mbed' if mbedlib else 'mbed-os'
try:
with cd(d_path):
Expand Down

0 comments on commit 502fa9c

Please sign in to comment.