 35c903494c
			
		
	
	
		35c903494c
		
			
		
	
	
	
	
		
			
			* fbt: optional shallow submodule checkout * fbt: more git threads by default * fbt: git condition fix * fbt: renamed FBT_SHALLOW to FBT_GIT_SUBMODULE_SHALLOW * github: enabled FBT_GIT_SUBMODULE_SHALLOW in flows * fbt: always compile icons' .c, even if user does not specify a proper source glob; changed glob to require files at user-specified paths to exist * fbt: fail build for missing imports in .faps * fbt: moved STRICT_FAP_IMPORT_CHECK to commandline options; enabled by default * ufbt: enabled STRICT_FAP_IMPORT_CHECK Co-authored-by: あく <alleteam@gmail.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| import SCons
 | |
| from fbt.util import GLOB_FILE_EXCLUSION
 | |
| from SCons.Script import Flatten
 | |
| from SCons.Node.FS import has_glob_magic
 | |
| 
 | |
| 
 | |
| def GlobRecursive(env, pattern, node=".", exclude=[]):
 | |
|     exclude = list(set(Flatten(exclude) + GLOB_FILE_EXCLUSION))
 | |
|     # print(f"Starting glob for {pattern} from {node} (exclude: {exclude})")
 | |
|     results = []
 | |
|     if isinstance(node, str):
 | |
|         node = env.Dir(node)
 | |
|     # Only initiate actual recursion if special symbols can be found in 'pattern'
 | |
|     if has_glob_magic(pattern):
 | |
|         for f in node.glob("*", source=True, exclude=exclude):
 | |
|             if isinstance(f, SCons.Node.FS.Dir):
 | |
|                 results += env.GlobRecursive(pattern, f, exclude)
 | |
|         results += node.glob(
 | |
|             pattern,
 | |
|             source=True,
 | |
|             exclude=exclude,
 | |
|         )
 | |
|     # Otherwise, just assume that file at path exists
 | |
|     else:
 | |
|         results.append(node.File(pattern))
 | |
|     # print(f"Glob result for {pattern} from {node}: {results}")
 | |
|     return results
 | |
| 
 | |
| 
 | |
| def generate(env):
 | |
|     env.AddMethod(GlobRecursive)
 | |
| 
 | |
| 
 | |
| def exists(env):
 | |
|     return True
 |