=== removed file 'data/cluefile.rng' --- data/cluefile.rng 2007-02-09 17:50:43 +0000 +++ data/cluefile.rng 1970-01-01 00:00:00 +0000 @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - not - - - - - - - - - - not - - - - - - - - - - - - - not - - - - - - - === modified file 'bugHelper/XMLOperations.py' --- bugHelper/XMLOperations.py 2007-04-12 10:44:22 +0000 +++ bugHelper/XMLOperations.py 2007-04-19 16:16:32 +0000 @@ -10,21 +10,28 @@ CLUE_FILE_VERSION = "0.2" -def find_schema(): - schema = os.path.join(os.getcwd(), "data/cluefile.rng") - if os.path.exists(schema): - return schema - - schema = os.path.join(os.getcwd(), "../data/cluefile.rng") - if os.path.exists(schema): - return schema - - schema = "/usr/share/bughelper/cluefile.rng" - if os.path.exists(schema): - return schema - +def find_schema(path, version): + schema = os.path.join(path, "schemas/cluefile-%s.rng" % version) + if os.path.exists(schema): + return schema return '' +def get_clue_file_version(xml_file): + try: + doc = libxml2.parseFile(xml_file) + except: + return CLUE_FILE_VERSION + + ctxt = doc.xpathNewContext() + clue_version = ctxt.xpathEval("/clues/@version") + if not clue_version: + return CLUE_FILE_VERSION + + version = str(clue_version[0].getContent()) + ctxt.xpathFreeContext() + doc.freeDoc() + return version + def rng_validate(schema, xml_file): rng_parser = libxml2.relaxNGNewParserCtxt(schema) @@ -69,6 +76,10 @@ else: return ([], [], []) + if get_clue_file_version(xml_file).split(".")[0] != \ + CLUE_FILE_VERSION.split(".")[0]: + return ([], [], []) + ctxt = doc.xpathNewContext() clues = set() inherits = set([n.content for n in === modified file 'bugxml' --- bugxml 2007-02-14 17:54:38 +0000 +++ bugxml 2007-04-19 15:56:27 +0000 @@ -53,11 +53,6 @@ sys.exit(1) if cl.options.cluefile: - schema = XMLOperations.find_schema() - if not schema: - print "Schema file not found." - sys.exit(1) - xml_file = cl.options.cluefile if not cl.options.cluefile or not os.path.exists(xml_file): if not os.path.exists(os.path.join(os.getcwd(), @@ -67,6 +62,12 @@ sys.exit(1) else: xml_file = os.path.join(os.getcwd(), xml_file) + + schema = XMLOperations.find_schema(conf.local_packages_dir.strip(), + XMLOperations.get_clue_file_version(xml_file)) + if not schema: + print "Schema file not found." + sys.exit(1) if not XMLOperations.rng_validate(schema, xml_file): print "%s does not validate against %s." % (xml_file, schema) === modified file 'setup.py' --- setup.py 2007-03-16 15:29:46 +0000 +++ setup.py 2007-04-19 16:08:28 +0000 @@ -20,8 +20,7 @@ version=version, packages=['bugHelper', 'launchpadBugs'], scripts=['bughelper','bugnumbers','bugxml'], - data_files=[('share/bughelper/', glob.glob('data/*.rng')), - ('share/doc/bughelper/', ['data/example.info']) + data_files=[('share/doc/bughelper/', ['data/example.info']) ] )