diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2014-04-26 15:11:58 +0200 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2014-04-26 15:11:58 +0200 |
commit | 140d836e9cd54fb67b969fd82ef7ed19ba574d40 (patch) | |
tree | 0df3e32ee39603d43f9b90fd2f2e1f7cce4249d4 /bin/docs-update-generated.py | |
parent | cb3425abe0bc2d05caf401ca24b82a25a81f009d (diff) |
Imported Upstream version 2.3.1upstream/2.3.1
Diffstat (limited to 'bin/docs-update-generated.py')
-rw-r--r-- | bin/docs-update-generated.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/docs-update-generated.py b/bin/docs-update-generated.py new file mode 100644 index 0000000..66b22c0 --- /dev/null +++ b/bin/docs-update-generated.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# Searches through the whole source tree and updates +# the generated *.gen/*.mod files in the docs folder, keeping all +# documentation for the tools, builders and functions... +# as well as the entity declarations for them. +# Uses scons-proc.py under the hood... +# + +import os +import SConsDoc + +# Directory where all generated files are stored +gen_folder = os.path.join('doc','generated') + +def argpair(key): + """ Return the argument pair *.gen,*.mod for the given key. """ + arg = '%s,%s' % (os.path.join(gen_folder,'%s.gen' % key), + os.path.join(gen_folder,'%s.mod' % key)) + + return arg + +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('python %s -b %s -f %s -t %s -v %s %s' % + (os.path.join('bin','scons-proc.py'), + argpair('builders'), argpair('functions'), + argpair('tools'), argpair('variables'), ' '.join(flist))) + + +if __name__ == "__main__": + generate_all() |