aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2017-11-22 16:12:57 +0100
committerDiana Picus <diana.picus@linaro.org>2017-11-23 04:53:37 +0100
commitadb07c441e2a96996c42142859b97b1baf7033ed (patch)
treea03e74ef354cf27ec16c3dd14ec4685a796b3c3c /scripts
parent36317e8a70960c6a2467eb4c01aa8ee74caa285c (diff)
downloadlinaro-scripts-adb07c441e2a96996c42142859b97b1baf7033ed.tar.gz
Move --repos flag to projects subcommand
The --repos flag is not used by all the subcommands, so there's no reason for it to be compulsory. This commit moves it from the generic llvm.py options to the options for the projects subcommand, where it is only required when adding subprojects. Change-Id: I7ad10bda6e1b4efeb594b09e5fda200850d99c07
Diffstat (limited to 'scripts')
-rw-r--r--scripts/llvm.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/llvm.py b/scripts/llvm.py
index 4b18560..27b8cb7 100644
--- a/scripts/llvm.py
+++ b/scripts/llvm.py
@@ -1,6 +1,7 @@
"""This is the main tool for handling llvm builds, bisects etc."""
import os
+from sys import argv
from sys import exit
from modules.llvm import LLVMSubproject
@@ -103,12 +104,8 @@ options.add_argument(
'--env',
required=True,
help="Path to the environment to update.")
-options.add_argument(
- '--repos', required=True,
- help="Path to the directory containing the repositories for all LLVM "
- "subprojects.")
-subcommands = options.add_subparsers()
+subcommands = options.add_subparsers(dest="subcommand")
# Subcommand for adding / removing subprojects
projs = subcommands.add_parser(
@@ -138,6 +135,10 @@ projs.add_argument(
choices=valid_subprojects,
metavar='subproject',
help="Disable given subprojects.")
+projs.add_argument(
+ '--repos',
+ help="Path to the directory containing the repositories for all LLVM "
+ "subprojects.")
# Subcommand for pushing the current branch to origin
push = subcommands.add_parser(
@@ -147,4 +148,7 @@ push = subcommands.add_parser(
push.set_defaults(run_command=push_current_branch)
args = options.parse_args()
+if args.subcommand == "projects" and args.add and not args.repos:
+ projs.error(
+ "When adding a subproject you must also pass the --repos argument")
args.run_command(args)