mirror of https://github.com/ARMmbed/mbed-os.git
Format detect_targets.py
parent
2831eee216
commit
ec1d0b5673
|
@ -14,18 +14,13 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
TEST BUILD & RUN
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
|
|
||||||
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
sys.path.insert(0, ROOT)
|
sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
|
|
||||||
from tools.options import get_default_options_parser
|
from tools.options import get_default_options_parser
|
||||||
|
|
||||||
# Check: Extra modules which are required by core test suite
|
# Check: Extra modules which are required by core test suite
|
||||||
|
@ -37,54 +32,61 @@ from tools.build_api import mcu_toolchain_matrix
|
||||||
from tools.test_api import get_autodetected_MUTS_list
|
from tools.test_api import get_autodetected_MUTS_list
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
|
"""Entry Point"""
|
||||||
try:
|
try:
|
||||||
# Parse Options
|
# Parse Options
|
||||||
parser = get_default_options_parser()
|
parser = get_default_options_parser()
|
||||||
|
|
||||||
parser.add_argument("-S", "--supported-toolchains",
|
parser.add_argument("-S", "--supported-toolchains",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="supported_toolchains",
|
dest="supported_toolchains",
|
||||||
default=False,
|
default=False,
|
||||||
help="Displays supported matrix of targets and toolchains")
|
help="Displays supported matrix of"
|
||||||
|
" targets and toolchains")
|
||||||
|
|
||||||
parser.add_argument('-f', '--filter',
|
parser.add_argument('-f', '--filter',
|
||||||
dest='general_filter_regex',
|
dest='general_filter_regex',
|
||||||
default=None,
|
default=None,
|
||||||
help='Filter targets')
|
help='Filter targets')
|
||||||
|
|
||||||
parser.add_argument("-v", "--verbose",
|
parser.add_argument("-v", "--verbose",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="verbose",
|
dest="verbose",
|
||||||
default=False,
|
default=False,
|
||||||
help="Verbose diagnostic output")
|
help="Verbose diagnostic output")
|
||||||
|
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
# Only prints matrix of supported toolchains
|
# Only prints matrix of supported toolchains
|
||||||
if options.supported_toolchains:
|
if options.supported_toolchains:
|
||||||
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
|
print mcu_toolchain_matrix(
|
||||||
|
platform_filter=options.general_filter_regex)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
# If auto_detect attribute is present, we assume other auto-detection
|
# If auto_detect attribute is present, we assume other auto-detection
|
||||||
# parameters like 'toolchains_filter' are also set.
|
# parameters like 'toolchains_filter' are also set.
|
||||||
MUTs = get_autodetected_MUTS_list()
|
muts = get_autodetected_MUTS_list()
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
for mut in MUTs.values():
|
for mut in muts.values():
|
||||||
print ""
|
print ""
|
||||||
print "[mbed] Detected %s, port %s, mounted %s" % (mut['mcu'], mut['port'], mut['disk'])
|
print "[mbed] Detected %s, port %s, mounted %s" % \
|
||||||
|
(mut['mcu'], mut['port'], mut['disk'])
|
||||||
print "[mbed] Supported toolchains for %s" % mut['mcu']
|
print "[mbed] Supported toolchains for %s" % mut['mcu']
|
||||||
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
|
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if count == 0:
|
if count == 0:
|
||||||
print "[mbed] No mbed targets where detected on your system."
|
print "[mbed] No mbed targets where detected on your system."
|
||||||
|
|
||||||
except KeyboardInterrupt, e:
|
except KeyboardInterrupt:
|
||||||
print "\n[CTRL+c] exit"
|
print "\n[CTRL+c] exit"
|
||||||
except Exception,e:
|
except Exception as exc:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
print "[ERROR] %s" % str(e)
|
print "[ERROR] %s" % str(exc)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue