Skip to content

Commit e486633

Browse files
committed
Improved handling of arbitrary .lib files (not just uVision static libs)
1 parent 04888aa commit e486633

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

mbed/mbed.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,16 @@ def fromurl(cls, url, path=None):
819819
def fromlib(cls, lib=None):
820820
with open(lib) as f:
821821
ref = f.read(200)
822-
if ref.startswith('!<arch>'):
823-
warning(
824-
"A static library \"%s\" in \"%s\" uses a non-standard .lib file extension, which is not compatible with the mbed build tools.\n"
825-
"Please change the extension of \"%s\" (for example to \"%s\").\n" % (os.path.basename(lib), os.path.split(lib)[0], os.path.basename(lib), os.path.basename(lib).replace('.lib', '.ar')))
826-
return False
827-
else:
828-
return cls.fromurl(ref, lib[:-4])
822+
823+
m_local = re.match(regex_local_ref, ref.strip().replace('\\', '/'))
824+
m_repo_url = re.match(regex_url_ref, ref.strip().replace('\\', '/'))
825+
m_bld_url = re.match(regex_build_url, ref.strip().replace('\\', '/'))
826+
if not (m_local or m_bld_url or m_repo_url):
827+
warning(
828+
"File \"%s\" in \"%s\" uses a non-standard .lib file extension, which is not compatible with the mbed build tools.\n" % (os.path.basename(lib), os.path.split(lib)[0]))
829+
return False
830+
else:
831+
return cls.fromurl(ref, lib[:-4])
829832

830833
@classmethod
831834
def fromrepo(cls, path=None):

0 commit comments

Comments
 (0)