From b6f56721cb68e7020d2be7c17362634b795f2ed8 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 22 Jan 2011 17:06:04 +0100 Subject: [PATCH] Changed sphinxgen's mechanism so that we don't have to copy the whole sphinx source dir every time we generate help. --HG-- rename : help/en/changelog.rst => help/en/changelog.tmpl rename : help/en/conf.py => help/en/conf.tmpl rename : help/fr/changelog.rst => help/fr/changelog.tmpl rename : help/fr/conf.py => help/fr/conf.tmpl --- .hgignore | 4 +++- build.py | 13 +++++++++---- help/en/{changelog.rst => changelog.tmpl} | 0 help/en/{conf.py => conf.tmpl} | 2 +- help/fr/{changelog.rst => changelog.tmpl} | 0 help/fr/{conf.py => conf.tmpl} | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) rename help/en/{changelog.rst => changelog.tmpl} (100%) rename help/en/{conf.py => conf.tmpl} (99%) rename help/fr/{changelog.rst => changelog.tmpl} (100%) rename help/fr/{conf.py => conf.tmpl} (99%) diff --git a/.hgignore b/.hgignore index ce6e2296..edb6b2a1 100644 --- a/.hgignore +++ b/.hgignore @@ -18,4 +18,6 @@ cocoa/*/build cocoa/*/dg_cocoa.plugin qt/base/*_rc.py qt/lang/fr.qm -qt/lang/en.qm \ No newline at end of file +qt/lang/en.qm +help/*/conf.py +help/*/changelog.rst \ No newline at end of file diff --git a/build.py b/build.py index 9d83d2aa..bc22c6bc 100644 --- a/build.py +++ b/build.py @@ -17,12 +17,14 @@ from setuptools import setup from distutils.extension import Extension from hscommon import sphinxgen -from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, ensure_empty_folder, +from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, filereplace, get_module_version, build_all_cocoa_locs, build_all_qt_locs) def parse_args(): usage = "usage: %prog [options]" parser = OptionParser(usage=usage) + parser.add_option('--clean', action='store_true', dest='clean', + help="Clean build folder before building") parser.add_option('--only-help', action='store_true', dest='only_help', help="Build only help file") (options, args) = parser.parse_args() @@ -98,14 +100,13 @@ def build_help(edition): print("Generating Help") current_path = op.abspath('.') help_basepath = op.join(current_path, 'help', 'en') - help_buildpath = op.join(current_path, 'build', 'sphinx_src'.format(edition)) help_destpath = op.join(current_path, 'build', 'help'.format(edition)) changelog_path = op.join(current_path, 'help', 'changelog_{}'.format(edition)) tixurl = "https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}" appname = {'se': 'dupeGuru', 'me': 'dupeGuru Music Edition', 'pe': 'dupeGuru Picture Edition'}[edition] homepage = 'http://www.hardcoded.net/dupeguru{}/'.format('_' + edition if edition != 'se' else '') confrepl = {'edition': edition, 'appname': appname, 'homepage': homepage} - sphinxgen.gen(help_basepath, help_buildpath, help_destpath, changelog_path, tixurl, confrepl) + sphinxgen.gen(help_basepath, help_destpath, changelog_path, tixurl, confrepl) def build_pe_modules(ui): def move(src, dst): @@ -163,7 +164,11 @@ def main(): dev = conf['dev'] if dev: print("Building in Dev mode") - ensure_empty_folder('build') + if options.clean: + if op.exists('build'): + shutil.rmtree('build') + if not op.exists('build'): + os.mkdir('build') if options.only_help: build_help(edition) else: diff --git a/help/en/changelog.rst b/help/en/changelog.tmpl similarity index 100% rename from help/en/changelog.rst rename to help/en/changelog.tmpl diff --git a/help/en/conf.py b/help/en/conf.tmpl similarity index 99% rename from help/en/conf.py rename to help/en/conf.tmpl index a4cacc6f..4329b4cd 100644 --- a/help/en/conf.py +++ b/help/en/conf.tmpl @@ -127,7 +127,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/help/fr/changelog.rst b/help/fr/changelog.tmpl similarity index 100% rename from help/fr/changelog.rst rename to help/fr/changelog.tmpl diff --git a/help/fr/conf.py b/help/fr/conf.tmpl similarity index 99% rename from help/fr/conf.py rename to help/fr/conf.tmpl index 797c8af7..0eaf388b 100644 --- a/help/fr/conf.py +++ b/help/fr/conf.tmpl @@ -127,7 +127,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format.