diff --git a/docs/src/conf.py b/docs/src/conf.py index f71f344..a4cf388 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -50,7 +50,7 @@ def prepare(globs, locs): stdout=PIPE).communicate()[0].strip() git_hash = Popen([git, 'rev-parse', 'HEAD'], stdout=PIPE).communicate()[0].strip() - project = origin.rpartition('/')[2] + vendor, project = origin.rpartition(':')[2].split('/')[-2:] if project.endswith('.git'): project = project[:-4] os.environ['SPHINX_PROJECT'] = project @@ -92,23 +92,28 @@ def prepare(globs, locs): # Remove extra files/folders. try: + print "Removing %s ..." % join(root, 'build') shutil.rmtree(join(root, 'build')) - except OSError: - pass + except OSError, e: + print "Could not delete build folder recursively" + print "Error was: %s" % str(e) os.mkdir(join(root, 'build')) shutil.move( join(root, 'docs', 'api', 'html'), join(root, 'build', 'apidoc'), ) try: + print "Moving %s to %s ..." % ( + join(root, '%s.tagfile.xml' % os.environ['SPHINX_PROJECT']), + join(root, 'build', 'apidoc', '%s.tagfile.xml' % os.environ['SPHINX_PROJECT']), + ) shutil.move( - join(root, '%s.tagfile.xml' % - os.environ['SPHINX_PROJECT']), - join(root, 'build', 'apidoc', '%s.tagfile.xml' % - os.environ['SPHINX_PROJECT']) + join(root, '%s.tagfile.xml' % os.environ['SPHINX_PROJECT']), + join(root, 'build', 'apidoc', '%s.tagfile.xml' % os.environ['SPHINX_PROJECT']) ) except OSError: - pass + print "Could not move the tagfile to its final destination" + print "Error was: %s" % str(e) # Copy translations for generic docs to catalogs folder. gen_i18n = join(root, 'docs', 'src', 'generic', 'i18n', '.')[:-1] @@ -120,6 +125,7 @@ def prepare(globs, locs): ) translation = join(translation, 'LC_MESSAGES', 'generic') shutil.rmtree(target_dir, ignore_errors=True) + print "Copying %s/ to %s/ ..." % (translation, target_dir) shutil.copytree(translation, target_dir) # Compile translation catalogs. @@ -128,6 +134,7 @@ def prepare(globs, locs): for po in fnmatch.filter(filenames, '*.po'): po = join(base, po) mo = po[:-3] + '.mo' + print "Compiling %s into %s ..." % (po, mo) call([pybabel, 'compile', '-f', '--statistics', '-i', po, '-o', mo]) @@ -142,7 +149,6 @@ def prepare(globs, locs): if 'html_extra_path' not in locs: locs['html_extra_path'] = [] locs['html_extra_path'].append(join(root, 'build')) - locs['html_theme'] = 'haiku' # - I18N if 'locale_dirs' not in locs: @@ -151,7 +157,8 @@ def prepare(globs, locs): if 'rst_prolog' not in locs: locs['rst_prolog'] = '' - locs['rst_prolog'] += '\n .. _`this_commit`: https://github.com/%s/commit/%s\n' % ( + locs['rst_prolog'] += '\n .. _`this_commit`: https://github.com/%s/%s/commit/%s\n' % ( + vendor, project, git_hash, )