Espruino/scripts/get_board_info.py
2023-09-27 14:57:47 +01:00

41 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ----------------------------------------------------------------------------------------
# Simple script to extract the user-friendly name of the board from boards/BOARDNAME.py
# Used when auto-generating the website
# ----------------------------------------------------------------------------------------
import subprocess;
import re;
import json;
import sys;
import os;
import importlib;
scriptdir = os.path.dirname(os.path.realpath(__file__))
basedir = scriptdir+"/../"
sys.path.append(basedir+"scripts");
sys.path.append(basedir+"boards");
import common;
import pinutils;
# -----------------------------------------------------------------------------------------
# Now scan AF file
if len(sys.argv)!=3:
print("ERROR, USAGE: get_board_info.py BOARD_NAME 'board.info.foo'")
exit(1)
boardname = sys.argv[1]
# import the board def
board = importlib.import_module(boardname)
print(eval(sys.argv[2]));