diff options
author | Rob Austein <sra@hactrn.net> | 2011-12-09 01:33:38 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2011-12-09 01:33:38 +0000 |
commit | 61a8790f819698d446fad92678af6b73027f6bbf (patch) | |
tree | faa8d7a5f8a63381681dbe8ba8ed669a4f4ca4c9 /buildtools/make-relaxng.py | |
parent | ce1e9d0cdaa5c189497de6aec51483e3c85e2f21 (diff) |
Rework models slightly. Now parsing most of the BPKI stuff.
svn path=/branches/tk100/; revision=4109
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() } |