|
31 | 31 | import zipfile
|
32 | 32 |
|
33 | 33 |
|
| 34 | +# Application version |
| 35 | +ver = '0.6.3' |
| 36 | + |
34 | 37 | # Default paths to Mercurial and Git
|
35 | 38 | hg_cmd = 'hg'
|
36 | 39 | git_cmd = 'git'
|
37 |
| -ver = '0.6.3' |
38 | 40 |
|
39 | 41 | ignores = [
|
40 | 42 | # Version control folders
|
|
88 | 90 |
|
89 | 91 | # reference to local (unpublished) repo - dir#rev
|
90 | 92 | regex_local_ref = r'^([\w.+-][\w./+-]*?)/?(?:#(.*))?$'
|
91 |
| - |
92 | 93 | # reference to repo - url#rev
|
93 | 94 | regex_url_ref = r'^(.*/([\w+-]+)(?:\.\w+)?)/?(?:#(.*))?$'
|
94 | 95 |
|
95 | 96 | # git url (no #rev)
|
96 | 97 | regex_git_url = r'^(git@|git\://|ssh\://|https?\://)([^/:]+)[:/](.+?)(\.git|\/?)$'
|
97 |
| - |
98 | 98 | # hg url (no #rev)
|
99 | 99 | regex_hg_url = r'^(file|ssh|https?)://([^/:]+)/([^/]+)/?([^/]+?)?$'
|
100 | 100 |
|
101 | 101 | # mbed url is subset of hg. mbed doesn't support ssh transport
|
102 | 102 | regex_mbed_url = r'^(https?)://([\w\-\.]*mbed\.(co\.uk|org|com))/(users|teams)/([\w\-]{1,32})/(repos|code)/([\w\-]+)/?$'
|
103 | 103 | regex_build_url = r'^(https?://([\w\-\.]*mbed\.(co\.uk|org|com))/(users|teams)/([\w\-]{1,32})/(repos|code)/([\w\-]+))/builds/?([\w\-]{12,40}|tip)?/?$'
|
104 | 104 |
|
| 105 | +# base url for all mbed related repos (used as sort of index) |
| 106 | +mbed_base_url = 'https://github.com/ARMmbed' |
105 | 107 | # default mbed OS url
|
106 | 108 | mbed_os_url = 'https://github.com/ARMmbed/mbed-os'
|
107 |
| - |
108 | 109 | # default mbed library url
|
109 | 110 | mbed_lib_url = 'https://mbed.org/users/mbed_official/code/mbed/builds/'
|
110 |
| - |
111 | 111 | # mbed SDK tools needed for programs based on mbed SDK library
|
112 | 112 | mbed_sdk_tools_url = 'https://mbed.org/users/mbed_official/code/mbed-sdk-tools'
|
113 | 113 |
|
@@ -868,6 +868,11 @@ def revtype(cls, rev, ret_rev=False):
|
868 | 868 | else:
|
869 | 869 | return 'branch' + (' '+rev if ret_rev else '')
|
870 | 870 |
|
| 871 | + @classmethod |
| 872 | + def isurl(cls, url): |
| 873 | + m = re.match(regex_url_ref, url.strip().replace('\\', '/')) |
| 874 | + return True if m else False |
| 875 | + |
871 | 876 | @property
|
872 | 877 | def lib(self):
|
873 | 878 | return self.path + '.' + ('bld' if self.is_build else 'lib')
|
@@ -1447,6 +1452,10 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
|
1447 | 1452 | def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
|
1448 | 1453 | global cwd_root
|
1449 | 1454 |
|
| 1455 | + # translate 'mbed-os' to https://github.com/ARMmbed/mbed-os |
| 1456 | + if not Repo.isurl(url) and not os.path.exists(url): |
| 1457 | + url = mbed_base_url+'/'+url |
| 1458 | + |
1450 | 1459 | repo = Repo.fromurl(url, path)
|
1451 | 1460 | if top:
|
1452 | 1461 | if cwd_type != "directory":
|
|
0 commit comments