From 0cc82280054af41bce192134aa86ff5e245031cb Mon Sep 17 00:00:00 2001 From: Erik Kooistra <kooistra@astron.nl> Date: Wed, 4 Feb 2015 09:18:11 +0000 Subject: [PATCH] Fixed 100m), used cm.list_duplicates() to exit in case there is a duplciate hdl_lib_name. --- tools/hdltool_readme.txt | 6 +++--- tools/oneclick/base/hdl_config.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/hdltool_readme.txt b/tools/hdltool_readme.txt index f979f976ec..edeaabcb38 100644 --- a/tools/hdltool_readme.txt +++ b/tools/hdltool_readme.txt @@ -532,8 +532,8 @@ c) quartus_* keys and synth_top_level_entity d) *_copy_files keys . The copy_files() method in hdl_config.py currently uses shutil.rmtree(buildPath), this is probably too risky and needs to be made more save to avoid that accidentally some wrong dir tree is removed. Eg. by only accepting - shutil.rmtree(buildPath) for subdirectories within $HDL_BUILD_DIR directory and otherwise asking the user to - confirm. + shutil.rmtree(buildPath) for local subdirectories or subdirectories within the $HDL_BUILD_DIR directory and + otherwise exit or ask the user to confirm. . The source and destination directory definition needs to be made somewhat more clear. The path can be absolute or relative. The relative path can be from hdllib.cfg location in SVN or from the build dir. The direction van be from build dir to dir in SVN or vice versa, or to any directory location. @@ -659,7 +659,7 @@ l) Location of modelsim_project_files.txt Default the modelsim_project_files.txt is now created in the SVN directory set by 'toolRootDir'/modelsim. Instead the modelsim_project_files.txt should better be created in the build directory 'build_dir_sim'/modelsim/. -m) Issue exit error when a library name occurs double +m) (FIXED) Issue exit error when a library name occurs double When a HDL library directory is copied and the hdllib.cfg is not updated then the library name will be double and cause misalignenment errors in the libraries lists which are difficult for a user to diagnose. The _init__ in hdl_config.py could check this. diff --git a/tools/oneclick/base/hdl_config.py b/tools/oneclick/base/hdl_config.py index fd062351ad..55b90fba05 100644 --- a/tools/oneclick/base/hdl_config.py +++ b/tools/oneclick/base/hdl_config.py @@ -79,6 +79,13 @@ class HdlConfig: self.libs = common_dict_file.CommonDictFile(libRootDir, libFileName) # library dict files if self.libs.nof_dicts==0: sys.exit('Error : No HDL library config file found') + # Keep list of HDL library names + self.lib_names = self.libs.get_key_values('hdl_lib_name') + + # Check that there are no duplicate library names (eg. due to copying a hdlib.cfg without modifying the hdl_lib_name value) + duplicate_lib_names = cm.list_duplicates(self.lib_names) + if len(duplicate_lib_names)>0: sys.exit('Error : Duplicate HDL library config file found %s' % duplicate_lib_names) + # Keep the generic HDL libraries and remove those that do not match the specified IP technologies self.technologyNames = cm.listify(technologyNames) self.removed_dicts = [] @@ -88,9 +95,7 @@ class HdlConfig: self.removed_dicts.append(d) for d in self.removed_dicts: self.libs.remove_dict_from_list(d) - - self.lib_names = self.libs.get_key_values('hdl_lib_name') - + def derive_all_use_libs(self, lib_name): """Derive a list of all HDL libraries that the specified HDL lib_name library depends on. -- GitLab