From 5de07b078d47b476819e341178e25d9d58042429 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 25 Nov 2015 17:49:47 +0000 Subject: [PATCH] Be *stupider* about what constitutes a supported language binding. We were trying to be super smart and find all the supported language bindings. This led to us scanning the directory and treating all subdirectories as language binding directories. This makes it hard to add unrelated code in this folder. Besides, we only support one at the moment - Python. And when new ones are added it will be trivial to just add their names to a list. So this patch gets stupider about how to look for language binding subfolders. Just put them in a list, and use the list. llvm-svn: 254078 --- lldb/scripts/finishSwigWrapperClasses.py | 19 +------------------ lldb/scripts/prepare_bindings.py | 12 +----------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/lldb/scripts/finishSwigWrapperClasses.py b/lldb/scripts/finishSwigWrapperClasses.py index 20c066aa3864..8d7d19ef1bdf 100644 --- a/lldb/scripts/finishSwigWrapperClasses.py +++ b/lldb/scripts/finishSwigWrapperClasses.py @@ -253,24 +253,7 @@ def run_post_process_for_each_script_supported(vDictArgs): return (-8, strScriptDirNotFound) # Look for any script language directories to build for - listDirs = [] - nDepth = 1 - for strPath, listDirs, listFiles in os.walk(strScriptDir): - nDepth = nDepth - 1 - if nDepth == 0: - break - - # Skip the directory that contains the interface files. - listDirs.remove('interface') - # and the svn directory. - if '.svn' in listDirs: - listDirs.remove('.svn') - - if gbDbgFlag: - sys.stdout.write(strScriptLangsFound) - for dir in listDirs: - sys.stdout.write(dir) - print("\n") + listDirs = ["Python"] # Iterate script directory find any script language directories for scriptLang in listDirs: diff --git a/lldb/scripts/prepare_bindings.py b/lldb/scripts/prepare_bindings.py index 0a0721157f17..3165f232e5ec 100755 --- a/lldb/scripts/prepare_bindings.py +++ b/lldb/scripts/prepare_bindings.py @@ -71,17 +71,7 @@ def prepare_all_bindings(options): logging.error("failed to find scripts dir: '%s'", scripts_dir) sys.exit(-8) - # Collect list of child directories. We expect there to be one - # for each supported script language. - child_dirs = [f for f in os.listdir(scripts_dir) - if os.path.isdir(os.path.join(scripts_dir, f))] - - # Remove directories that do not represent script languages. - for removal_dir in [".svn", "interface", "__pycache__", "sphinx", "swig_bot_lib"]: - if removal_dir in child_dirs: - child_dirs.remove(removal_dir) - - logging.info("found script directories: %s", child_dirs) + child_dirs = ["Python"] # Iterate script directory find any script language directories for script_lang in child_dirs: