def main(): """Perform the build, if necessary.""" if len(sys.argv) > 1: build_dir = sys.argv[1] else: build_dir = os.getcwd() os.chdir(build_dir) for source in glob.glob("*.JSON-tmLanguage"): target = grammar.xml_filename(source) if must_build(source, target): print("Building %s" % target) grammar.build(source) else: print("%s is up to date." % target)
def must_build(source, target): return (not os.path.exists(target)) \ or (os.path.getmtime(source) >= os.path.getmtime(target)) if len(sys.argv) > 1: dir = sys.argv[1] else: dir = os.getcwd() os.chdir(dir) for source in glob.glob('*.JSON-tmLanguage'): target = grammar.xml_filename(source) if must_build(source, target): print 'Building %s' % target grammar.build(source) else: print '%s is up to date.' % target ########NEW FILE######## __FILENAME__ = clean #!/usr/bin/env python import grammar, os, os.path, glob, sys if len(sys.argv) > 1: dir = sys.argv[1] else: dir = os.getcwd() os.chdir(dir)
return (not os.path.exists(target)) \ or (os.path.getmtime(source) >= os.path.getmtime(target)) if len(sys.argv) > 1: dir = sys.argv[1] else: dir = os.getcwd() os.chdir(dir) for source in glob.glob('*.JSON-tmLanguage'): target = grammar.xml_filename(source) if must_build(source, target): print 'Building %s' % target grammar.build(source) else: print '%s is up to date.' % target ########NEW FILE######## __FILENAME__ = clean #!/usr/bin/env python import grammar, os, os.path, glob, sys if len(sys.argv) > 1: dir = sys.argv[1] else: dir = os.getcwd() os.chdir(dir)