def generate_all(): """ Scan for XML files in the src directory and call scons-proc.py to generate the *.gen/*.mod files from it. """ flist = [] for path, dirs, files in os.walk('src'): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): flist.append(fpath) if flist: # Does the destination folder exist if not os.path.isdir(gen_folder): try: os.makedirs(gen_folder) except: print("Couldn't create destination folder %s! Exiting..." % gen_folder) return # Call scons-proc.py os.system('%s %s -b %s -f %s -t %s -v %s %s' % (sys.executable, os.path.join('bin', 'scons-proc.py'), argpair('builders'), argpair('functions'), argpair('tools'), argpair('variables'), ' '.join(flist)))
def generate_all(): """ Scan for XML files in the src directory and call scons-proc.py to generate the *.gen/*.mod files from it. """ flist = [] for path, dirs, files in os.walk('src'): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): flist.append(fpath) if flist: # Does the destination folder exist if not os.path.isdir(gen_folder): try: os.makedirs(gen_folder) except: print("Couldn't create destination folder %s! Exiting..." % gen_folder) return # Call scons-proc.py os.system('%s %s -b %s -f %s -t %s -v %s %s' % (sys.executable, os.path.join('bin','scons-proc.py'), argpair('builders'), argpair('functions'), argpair('tools'), argpair('variables'), ' '.join(flist)))
def generate_all(): """ Scan for XML files in the src directory and call scons-proc.py to generate the *.gen/*.mod files from it. """ flist = [] for path, dirs, files in os.walk('src'): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): flist.append(fpath) if flist: # Does the destination folder exist if not os.path.isdir(gen_folder): try: os.makedirs(gen_folder) except: print("Couldn't create destination folder %s! Exiting..." % gen_folder) return # Call scons-proc.py cp = subprocess.run([ sys.executable, os.path.join('bin', 'scons-proc.py'), '-b', argpair('builders'), '-f', argpair('functions'), '-t', argpair('tools'), '-v', argpair('variables') ] + flist, shell=False) # No-op: scons-proc doesn't actually set an exit code at the moment. if cp.returncode: print("Generation failed", file=sys.stderr)
def readAllExampleInfos(dpath): """ Scan for XML files in the given directory and collect together all relevant infos (files/folders, output commands) in a map, which gets returned. """ examples = {} for path, dirs, files in os.walk(dpath): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): readExampleInfos(fpath, examples) return examples
def generate_all(): """Generate the entity files. Scan for XML files in the SCons directory and call scons-proc.py to generate the *.gen/*.mod files from it. """ flist = [] for path, dirs, files in os.walk('SCons'): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): flist.append(fpath) if flist: # Does the destination folder exist try: os.makedirs(gen_folder, exist_ok=True) except Exception: print("Couldn't create destination folder %s! Exiting..." % gen_folder, file=sys.stdout) return False # Call scons-proc.py cp = subprocess.run( [ sys.executable, os.path.join('bin', 'scons-proc.py'), '-b', argpair('builders'), '-f', argpair('functions'), '-t', argpair('tools'), '-v', argpair('variables'), ] + flist, shell=False, ) if cp.returncode: print("Generation failed", file=sys.stderr) return False return True
def exampleNamesAreUnique(dpath): """ Scan for XML files in the given directory and check whether the scons_example names are unique. """ unique = True allnames = set() for path, dirs, files in os.walk(dpath): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): names, failed_suffixes = collectSConsExampleNames(fpath) if failed_suffixes: unique = False i = allnames.intersection(names) if i: print("Not unique in %s are: %s" % (fpath, ', '.join(i))) unique = False allnames |= names return unique
def exampleNamesAreUnique(dpath): """ Scan for XML files in the given directory and check whether the scons_example names are unique. """ unique = True allnames = set() for path, dirs, files in os.walk(dpath): for f in files: if f.endswith('.xml'): fpath = os.path.join(path, f) if SConsDoc.isSConsXml(fpath): names, failed_suffixes = collectSConsExampleNames(fpath) if failed_suffixes: unique = False i = allnames.intersection(names) if i: print "Not unique in %s are: %s" % (fpath, ', '.join(i)) unique = False allnames |= names return unique