| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
# @HEADER |
| 4 |
# ***************************************************************************** |
| 5 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 6 |
# |
| 7 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 8 |
# SPDX-License-Identifier: BSD-3-Clause |
| 9 |
# ***************************************************************************** |
| 10 |
# @HEADER |
| 11 |
|
| 12 |
from FindGeneralScriptSupport import * |
| 13 |
from TribitsPackageFilePathUtils import * |
| 14 |
from gitdist import addOptionParserChoiceOption |
| 15 |
|
| 16 |
|
| 17 |
# |
| 18 |
# Read in the commandline arguments |
| 19 |
# |
| 20 |
|
| 21 |
usageHelp = \ |
| 22 |
r"""get-tribits-packages.py --deps-xml-file=<DEPS_XML_FILE> \ |
| 23 |
--only-top-level-packages=[on|off] |
| 24 |
|
| 25 |
This script returns a comma-separated list of all of the project's top-level |
| 26 |
or packages or the full set of packages (i.e. parent and subpackages). |
| 27 |
""" |
| 28 |
|
| 29 |
from optparse import OptionParser |
| 30 |
|
| 31 |
clp = OptionParser(usage=usageHelp) |
| 32 |
|
| 33 |
clp.add_option( |
| 34 |
"--deps-xml-file", dest="depsXmlFile", type="string", |
| 35 |
help="File containing TriBITS-generated XML data-structure the listing"+\ |
| 36 |
" of packages, dir names, dependencies, etc.") |
| 37 |
|
| 38 |
addOptionParserChoiceOption( |
| 39 |
"--only-top-level-packages", "onlyTopLevelPackagesStr", |
| 40 |
("on", "off"), 0, |
| 41 |
"If 'on', then only top-level packages will be included. If 'off', then"+\ |
| 42 |
" top-level and subpackages will be included in the list (in order).", |
| 43 |
clp ) |
| 44 |
|
| 45 |
(options, args) = clp.parse_args() |
| 46 |
|
| 47 |
if options.onlyTopLevelPackagesStr == "on": |
| 48 |
onlyTopLevelPackages = True |
| 49 |
else: |
| 50 |
onlyTopLevelPackages = False |
| 51 |
|
| 52 |
trilinosDependencies = getProjectDependenciesFromXmlFile(options.depsXmlFile) |
| 53 |
|
| 54 |
packagesNamesList = trilinosDependencies.getPackagesNamesList(onlyTopLevelPackages) |
| 55 |
|
| 56 |
print(','.join(packagesNamesList)) |