Skip to content

Commit 2a5f3e3

Browse files
authored
Merge pull request #246 from screamerbg/epr
0.8.1 EPR fixes
2 parents f9c7864 + a0ed3d9 commit 2a5f3e3

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

mbed/mbed.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
# Application version
38-
ver = '0.8.0'
38+
ver = '0.8.1'
3939

4040
# Default paths to Mercurial and Git
4141
hg_cmd = 'hg'
@@ -688,7 +688,10 @@ def getrev():
688688

689689
# Gets current branch or returns empty string if detached
690690
def getbranch():
691-
branch = pquery([git_cmd, 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD']).strip()
691+
try:
692+
branch = pquery([git_cmd, 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD']).strip()
693+
except ProcessException:
694+
branch = "master"
692695
return branch if branch != "HEAD" else ""
693696

694697
# Finds refs (local or remote branches). Will match rev if specified
@@ -1023,10 +1026,12 @@ def write(self):
10231026
#print self.name, 'unmodified'
10241027
return
10251028

1026-
action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, self.fullurl))
1027-
1029+
ref = (formaturl(self.url, 'https').rstrip('/') + '/' +
1030+
(('' if self.is_build else '#') +
1031+
self.rev if self.rev else ''))
1032+
action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, ref))
10281033
with open(self.lib, 'wb') as f:
1029-
f.write(self.fullurl + '\n')
1034+
f.write(ref + '\n')
10301035

10311036
def rm_untracked(self):
10321037
untracked = self.scm.untracked()
@@ -1365,17 +1370,17 @@ def formaturl(url, format="default"):
13651370
url = 'ssh://%s/%s.git' % (m.group(2), m.group(3))
13661371
elif format == "http":
13671372
url = 'http://%s/%s' % (m.group(2), m.group(3))
1368-
else:
1369-
url = 'https://%s/%s' % (m.group(2), m.group(3)) # https is default
1373+
elif format == "https":
1374+
url = 'https://%s/%s' % (m.group(2), m.group(3))
13701375
else:
13711376
m = re.match(regex_hg_url, url)
13721377
if m:
13731378
if format == "ssh":
13741379
url = 'ssh://%s/%s' % (m.group(2), m.group(3))
13751380
elif format == "http":
13761381
url = 'http://%s/%s' % (m.group(2), m.group(3))
1377-
else:
1378-
url = 'https://%s/%s' % (m.group(2), m.group(3)) # https is default
1382+
elif format == "https":
1383+
url = 'https://%s/%s' % (m.group(2), m.group(3))
13791384
return url
13801385

13811386

@@ -2177,18 +2182,27 @@ def config_(var, value=None, global_cfg=False, unset=False):
21772182
@subcommand('target',
21782183
dict(name='name', nargs='?', help='Default target name. Example: K64F, NUCLEO_F401RE, NRF51822...'),
21792184
dict(name=['-G', '--global'], dest='global_cfg', action='store_true', help='Use global settings, not local'),
2185+
dict(name=['-S', '--supported'], dest='supported', action='store_true', help='Shows supported matrix of targets and toolchains'),
21802186
help='Set or get default target',
21812187
description=(
2182-
"This is an alias to 'mbed config target [--global] [name]'\n"))
2183-
def target_(name=None, global_cfg=False):
2188+
"Set or get default toolchain\n"
2189+
"This is an alias to 'mbed config [--global] target [name]'\n"))
2190+
def target_(name=None, global_cfg=False, supported=False):
2191+
if supported:
2192+
return compile_(supported=supported)
21842193
return config_('target', name, global_cfg=global_cfg)
21852194

21862195
@subcommand('toolchain',
21872196
dict(name='name', nargs='?', help='Default toolchain name. Example: ARM, uARM, GCC_ARM, IAR'),
2197+
dict(name=['-G', '--global'], dest='global_cfg', action='store_true', help='Use global settings, not local'),
2198+
dict(name=['-S', '--supported'], dest='supported', action='store_true', help='Shows supported matrix of targets and toolchains'),
21882199
help='Set or get default toolchain\n\n',
21892200
description=(
2190-
"This is an alias to 'mbed config toolchain [--global] [name]'\n"))
2191-
def toolchain_(name=None, global_cfg=False):
2201+
"Set or get default toolchain\n"
2202+
"This is an alias to 'mbed config [--global] toolchain [name]'\n"))
2203+
def toolchain_(name=None, global_cfg=False, supported=False):
2204+
if supported:
2205+
return compile_(supported=supported)
21922206
return config_('toolchain', name, global_cfg=global_cfg)
21932207

21942208
@subcommand('help',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def read(fname):
1919
setup(
2020
name="mbed-cli",
2121
packages=["mbed"],
22-
version="0.8.0",
22+
version="0.8.1",
2323
url='http://github.com/ARMmbed/mbed-cli',
2424
author='ARM mbed',
2525
author_email='[email protected]',

0 commit comments

Comments
 (0)