diff options
Diffstat (limited to 'cpp/config/makegitignore.py')
-rwxr-xr-x | cpp/config/makegitignore.py | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/cpp/config/makegitignore.py b/cpp/config/makegitignore.py index e0e8db24274..f25b2456ffe 100755 --- a/cpp/config/makegitignore.py +++ b/cpp/config/makegitignore.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import os, sys, shutil, fnmatch, re, time +import os, sys, shutil, fnmatch, re, time, getopt # # NOTE: This scripts generates .gitignore files in directories @@ -81,6 +81,31 @@ def createGitIgnore(filename, gitIgnoreFiles): file.close() +def usage(): + print "Usage: " + sys.argv[0] + " [options]" + print + print "Options:" + print "-e Run for Ice-E." + print "-h Show this message." + print + +icee = False +try: + opts, args = getopt.getopt(sys.argv[1:], "he") +except getopt.GetoptError: + usage() + sys.exit(1) +for o, a in opts: + if o == "-h": + usage() + sys.exit(0) + elif o == "-e": + icee = True +if len(args) != 0: + usage() + sys.exit(1) + + # # Find where the root of the tree is. # @@ -92,8 +117,10 @@ else: print("cannot find top-level directory") sys.exit(1) -makefiles = find(os.path.join(toplevel, "cpp"), "Makefile") -makefiles = makefiles + find(os.path.join(toplevel, "cppe"), "Makefile") +if icee: + makefiles = find(os.path.join(toplevel, "cppe"), "Makefile") +else: + makefiles = find(os.path.join(toplevel, "cpp"), "Makefile") cwd = os.getcwd() gitIgnoreFiles = { } for i in makefiles: @@ -112,7 +139,6 @@ os.chdir(cwd) excludePath = [ os.path.join(toplevel, "cpp", "bin"), os.path.join(toplevel, "cpp", "lib"), \ os.path.join(toplevel, "cppe", "bin"), os.path.join(toplevel, "cppe", "lib") ] -print excludePath for (path, files) in gitIgnoreFiles.iteritems(): if os.path.dirname(path) in excludePath: continue |