diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-03-07 20:11:00 +0100 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-03-20 17:19:11 +0100 |
commit | 134b7611d54c3ed27b26cba123aacc860fafc48b (patch) | |
tree | 3b434cf3cc7025b1027b716a397e48a899f447a4 /recipes/docbook-xsl.recipe | |
parent | 51874f223708eb06d3ebf33e76e9b95002e0ea9e (diff) |
docbook-xsl: add new recipe
Diffstat (limited to 'recipes/docbook-xsl.recipe')
-rw-r--r-- | recipes/docbook-xsl.recipe | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/recipes/docbook-xsl.recipe b/recipes/docbook-xsl.recipe new file mode 100644 index 00000000..5824fd52 --- /dev/null +++ b/recipes/docbook-xsl.recipe @@ -0,0 +1,35 @@ +from cerbero import recipe + +class Recipe(recipe.Recipe): + name = 'docbook-xsl' + version = '1.76.1' + + def prepare(self): + self._remove_steps(['configure', 'compile']) + + def install(self): + import os + etc_catalog_path = os.path.join(self.config.prefix, 'etc', 'catalog.xml') + new_catalog_path = os.path.join(self.build_dir, 'catalog.xml') + + def read_catalog(path): + try: + with open(path, 'r') as f: + lines= f.readlines() + if len(lines) != 0: + lines = lines[2:-1] + except Exception, ex: + lines = [''] + return ''.join(lines) + + etc_catalog_lines = read_catalog(etc_catalog_path) + new_catalog_lines = read_catalog(new_catalog_path) + if new_catalog_lines in etc_catalog_lines: + return + with open(etc_catalog_path, 'w') as f: + f.write("<?xml version='1.0'?>\n") + f.write('<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">\n') + f.write(etc_catalog_lines) + f.write("\n") + f.write(new_catalog_lines) + f.write("</catalog>") |