Skip to content

Commit 1da5950

Browse files
author
SamCHogg
committed
Add --no-requirements to other commands
1 parent 71da4fc commit 1da5950

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

mbed/mbed.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,13 +1877,14 @@ def thunk(parsed_args):
18771877
dict(name='--depth', nargs='?', help='Number of revisions to fetch the mbed OS repository when creating new program. Default: all revisions.'),
18781878
dict(name='--protocol', nargs='?', help='Transport protocol when fetching the mbed OS repository when creating new program. Supported: https, http, ssh, git. Default: inferred from URL.'),
18791879
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
1880+
dict(name='--no-requirements', action='store_true', help='Disables checking for and installing any requirements.'),
18801881
help='Create new mbed program or library',
18811882
description=(
18821883
"Creates a new mbed program if executed within a non-program location.\n"
18831884
"Alternatively creates an mbed library if executed within an existing program.\n"
18841885
"When creating new program, the latest mbed-os release will be downloaded/added\n unless --create-only is specified.\n"
18851886
"Supported source control management: git, hg"))
1886-
def new(name, scm='git', program=False, library=False, mbedlib=False, create_only=False, depth=None, protocol=None, offline=False):
1887+
def new(name, scm='git', program=False, library=False, mbedlib=False, create_only=False, depth=None, protocol=None, offline=False, no_requirements=False):
18871888
global cwd_root
18881889
offline_warning(offline)
18891890

@@ -1951,7 +1952,7 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
19511952
with cd(p_path):
19521953
sync()
19531954

1954-
Program(d_path).post_action()
1955+
Program(d_path).post_action(not no_requirements)
19551956

19561957

19571958
# Import command
@@ -1963,13 +1964,14 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
19631964
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
19641965
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
19651966
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
1967+
dict(name='--no-requirements', action='store_true', help='Disables checking for and installing any requirements.'),
19661968
hidden_aliases=['im', 'imp'],
19671969
help='Import program from URL',
19681970
description=(
19691971
"Imports mbed program and its dependencies from a source control based URL\n"
19701972
"(GitHub, Bitbucket, mbed.org) into the current directory or specified\npath.\n"
19711973
"Use \"mbed add <URL>\" to add a library into an existing program."))
1972-
def import_(url, path=None, ignore=False, depth=None, protocol=None, insecure=False, offline=False, top=True):
1974+
def import_(url, path=None, ignore=False, depth=None, protocol=None, insecure=False, offline=False, no_requirements=False, top=True):
19731975
global cwd_root
19741976
offline_warning(offline, top)
19751977

@@ -2029,7 +2031,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, insecure=Fa
20292031
deploy(ignore=ignore, depth=depth, protocol=protocol, insecure=insecure, offline=offline, top=False)
20302032

20312033
if top:
2032-
Program(repo.path).post_action()
2034+
Program(repo.path).post_action(not no_requirements)
20332035

20342036

20352037
# Add library command
@@ -2041,13 +2043,15 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, insecure=Fa
20412043
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
20422044
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
20432045
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
2046+
dict(name='--no-requirements', action='store_true', help='Disables checking for and installing any requirements.'),
20442047
hidden_aliases=['ad'],
20452048
help='Add library from URL',
20462049
description=(
20472050
"Adds mbed library and its dependencies from a source control based URL\n"
20482051
"(GitHub, Bitbucket, mbed.org) into an existing program.\n"
20492052
"Use \"mbed import <URL>\" to import as a program"))
2050-
def add(url, path=None, ignore=False, depth=None, protocol=None, insecure=False, offline=False, top=True):
2053+
def add(url, path=None, ignore=False, depth=None, protocol=None, insecure=False, offline=False, no_requirements=False, top=True):
2054+
20512055
offline_warning(offline, top)
20522056

20532057
repo = Repo.fromrepo()
@@ -2060,7 +2064,7 @@ def add(url, path=None, ignore=False, depth=None, protocol=None, insecure=False,
20602064
repo.add(lib.lib)
20612065

20622066
if top:
2063-
Program(repo.path).post_action()
2067+
Program(repo.path).post_action(not no_requirements)
20642068

20652069

20662070
# Remove library
@@ -2090,12 +2094,13 @@ def remove(path):
20902094
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
20912095
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
20922096
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
2097+
dict(name='--no-requirements', action='store_true', help='Disables checking for and installing any requirements.'),
20932098
help='Find and add missing libraries',
20942099
description=(
20952100
"Import missing dependencies in an existing program or library.\n"
20962101
"Hint: Use \"mbed import <URL>\" and \"mbed add <URL>\" instead of cloning\n"
20972102
"manually and then running \"mbed deploy\""))
2098-
def deploy(ignore=False, depth=None, protocol=None, insecure=False, offline=False, top=True):
2103+
def deploy(ignore=False, depth=None, protocol=None, insecure=False, offline=False, no_requirements=False, top=True):
20992104
offline_warning(offline, top)
21002105

21012106
repo = Repo.fromrepo()
@@ -2111,7 +2116,7 @@ def deploy(ignore=False, depth=None, protocol=None, insecure=False, offline=Fals
21112116

21122117
if top:
21132118
program = Program(repo.path)
2114-
program.post_action()
2119+
program.post_action(not no_requirements)
21152120
if program.is_classic:
21162121
program.update_tools(os.path.join(getcwd(), '.temp'))
21172122

0 commit comments

Comments
 (0)