Corrected element-info usage

Deprecated the `--expand-dependencies` flag from `element-info` usage.
The flag was required and not optional.  We can rely on argparse to exit non-0
when the required positional argument is not provided.

Change-Id: Iaf8eb962eb600760974bc33c30b809a07a23278e
Closes-Bug: 1265649
This commit is contained in:
jodewey 2015-01-26 18:01:50 -08:00
parent 87b4bc7d51
commit 8fc027227a
2 changed files with 9 additions and 7 deletions

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import argparse
import collections
import os
@ -115,16 +116,17 @@ def expand_dependencies(user_elements, elements_dir=None):
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument('elements', nargs='+',
help='elements to inspect')
help='display dependencies of the given elements')
parser.add_argument('--expand-dependencies', '-d', action='store_true',
default=False,
help='Print expanded dependencies of all args')
help=('(DEPRECATED) print expanded dependencies '
'of all args'))
args = parser.parse_args(argv[1:])
if args.expand_dependencies:
print(' '.join(expand_dependencies(args.elements)))
return 0
print("WARNING: expand-dependencies flag is deprecated, "
"and is now on by default.", file=sys.stderr)
sys.stderr.write("ERROR: please choose an option.\n")
return -1
print(' '.join(expand_dependencies(args.elements)))
return 0

View File

@ -221,7 +221,7 @@ function arg_to_elements() {
fi
echo "Building elements: $IMAGE_ELEMENT"
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info $IMAGE_ELEMENT)
export IMAGE_ELEMENT
echo "Expanded element dependencies to: $IMAGE_ELEMENT"