Skip to content
Snippets Groups Projects
Commit 1c11df5e authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added get_lib_names_from_lib_dicts(), check_library_names() and command line options --run, --lib.

parent 208ab8af
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,6 @@
import common as cm
import common_dict_file
import sys
import os
import os.path
import shutil
from distutils.dir_util import copy_tree
......@@ -118,6 +117,15 @@ class HdlConfig:
self.lib_names = self.libs.get_key_values('hdl_lib_name')
def check_library_names(self, check_lib_names, lib_names=None):
"""Check that HDL library names exists, if not then exit with Error message."""
if lib_names==None:
lib_names=self.lib_names
for check_lib_name in cm.listify(check_lib_names):
if check_lib_name not in cm.listify(lib_names):
sys.exit('Error : Unknown HDL library name %s found with check_lib_name()' % check_lib_name)
def get_used_libs(self, build_type, lib_dict, arg_include_ip_libs=[]):
"""Get the list of used HDL libraries from the lib_dict. Which libraries are actually used depends on the build_type:
......@@ -265,6 +273,13 @@ class HdlConfig:
return lib_dicts
def get_lib_names_from_lib_dicts(self, lib_dicts=None):
"""Get list the HDL libraries lib_names from list of HDL libraries lib_dicts and preseve the library order.
"""
lib_names = self.libs.get_key_values('hdl_lib_name', lib_dicts)
return lib_names
def get_tool_build_dir(self, build_type):
"""Get the central tool build directory.
......@@ -387,13 +402,24 @@ class HdlParseArgs:
def __init__(self, toolsetSelect):
# Parse command line arguments
argparser = argparse.ArgumentParser(description='HDL config command line parser arguments')
argparser.add_argument('-t','--toolset', help='choose toolset %s (default: %s)' % (toolsetSelect,toolsetSelect[0]), default=toolsetSelect[0], required=False)
argparser.add_argument('-v','--verbosity', help='verbosity >= 0 for more info', type=int, default=0, required=False)
argparser.add_argument('-t','--toolset', required=False, help='choose toolset %s (default: %s)' % (toolsetSelect,toolsetSelect[0]), default=toolsetSelect[0])
argparser.add_argument('-l','--lib', default=None, required=False, help='library names separated by commas')
argparser.add_argument('-r','--run', required=False, action='store_true', default=False, help='run command')
argparser.add_argument('-v','--verbosity', required=False, type=int, default=0, help='verbosity >= 0 for more info')
args = vars(argparser.parse_args())
# Keep the argparser for external access of e.g. print_help
self.argparser = argparser
# Keep arguments in class record
self.toolset = args['toolset']
self.lib_names = []
if args['lib']!=None:
self.lib_names = args['lib'].split(',')
self.run = args['run']
if self.toolset not in toolsetSelect:
print 'Toolset %s is not supported' % self.toolset
print 'Hint: give argument -h for possible options'
......@@ -478,6 +504,10 @@ if __name__ == '__main__':
print ''
print 'derive_lib_order for %s of %s = \n' % (build_type, top_lib), hdl.derive_lib_order(build_type, top_lib)
print ''
print 'Help: use -h'
hdl_args.argparser.print_help()
if mode==1:
key = 'build_dir'
new_value = '$HDL_BUILD_DIR'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment