Skip to content

Commit 1688f99

Browse files
committed
Show a warning when importing from a local folder
1 parent 98aab16 commit 1688f99

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mbed/mbed.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
17311731
global cwd_root
17321732

17331733
# translate 'mbed-os' to https://github.com/ARMmbed/mbed-os
1734+
orig_url = url
17341735
if not Repo.isurl(url) and not os.path.exists(url):
17351736
url = mbed_base_url+'/'+url
17361737

@@ -1746,6 +1747,9 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
17461747
if os.path.isdir(repo.path) and len(os.listdir(repo.path)) > 1:
17471748
error("Directory \"%s\" is not empty. Please ensure that the destination folder is empty." % repo.path, 1)
17481749

1750+
if not Repo.isurl(orig_url) and os.path.exists(orig_url):
1751+
warning("Importing from a local folder \"%s\", not from a URL" % orig_url)
1752+
17491753
text = "Importing program" if top else "Adding library"
17501754
action("%s \"%s\" from \"%s\"%s" % (text, relpath(cwd_root, repo.path), formaturl(repo.url, protocol), ' at '+(repo.revtype(repo.rev, True))))
17511755
if repo.clone(repo.url, repo.path, rev=repo.rev, depth=depth, protocol=protocol):

0 commit comments

Comments
 (0)