diff options
author | Rob Austein <sra@hactrn.net> | 2012-04-15 04:42:40 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2012-04-15 04:42:40 +0000 |
commit | fd695c2371824c1952510bab9fbe0e05b52b9e9d (patch) | |
tree | 60b9836b9d24055d900be3335856ec4e0091cec2 /buildtools/make-relaxng.py | |
parent | b5eb637d68bd8387cfff7cb06945f6654d1192db (diff) | |
parent | f4d381b2ead3a3fab4b7b0c73cdc8d3a6b4cb12d (diff) |
Merge branches/tk161 to trunk.
svn path=/trunk/; revision=4415
Diffstat (limited to 'buildtools/make-relaxng.py')
-rw-r--r-- | buildtools/make-relaxng.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/buildtools/make-relaxng.py b/buildtools/make-relaxng.py index 62decbae..0058ade5 100644 --- a/buildtools/make-relaxng.py +++ b/buildtools/make-relaxng.py @@ -3,7 +3,7 @@ Script to generate rpki/relaxng.py. $Id$ -Copyright (C) 2009 Internet Systems Consortium ("ISC") +Copyright (C) 2009-2011 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -32,7 +32,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -schemas = ("left_right", "up_down", "publication") +import sys format_1 = """\ # Automatically generated, do not edit. @@ -46,9 +46,15 @@ format_2 = """\ %(name)s = lxml.etree.RelaxNG(lxml.etree.fromstring('''%(rng)s''')) """ +def filename_to_symbol(s): + for suffix in (".rng", "-schema"): + if s.endswith(suffix): + s = s[:-len(suffix)] + return s.replace("-", "_") + print format_1 -for name in schemas: +for filename in sys.argv[1:]: print format_2 % { - "name" : name, - "rng" : open(name.replace("_", "-") + "-schema.rng").read() } + "name" : filename_to_symbol(filename), + "rng" : open(filename).read() } |