Author: bugman Date: Thu Oct 15 11:44:13 2015 New Revision: 28057 URL: http://svn.gna.org/viewcvs/relax?rev=28057&view=rev Log: The Scons compilation of the PDF and HTML manuals now checks for replicated titles. A new replicate_title_check target has been added to the scons scripts. This calls the find() method of the replicate LaTeX title finding script to determine if any titles are replicated, and if so the scons target returns with a sys.exit(1) call. This target is set at the start of the user_manual_pdf, user_manual_pdf_nofetch, user_manual_html, user_manual_html_nofetch scons targets. The result is that the manual cannot be compiled if replicate titles exist, forcing the titles to be changed. The result will be that the HTML pages at http://www.nmr-relax.com/manual/ will all be unique, as replicated titles results in only one HTML page being created for all the sections. Modified: trunk/scons/manuals.py trunk/sconstruct Modified: trunk/scons/manuals.py URL: http://svn.gna.org/viewcvs/relax/trunk/scons/manuals.py?rev=28057&r1=28056&r2=28057&view=diff ============================================================================== --- trunk/scons/manuals.py (original) +++ trunk/scons/manuals.py Thu Oct 15 11:44:13 2015 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2006-2014 Edward d'Auvergne # +# Copyright (C) 2006-2015 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -493,6 +493,34 @@ print("\n\n\n") +def replicate_title_check(target, source, env): + """Builder action for checking for replicated titles in the LaTeX sources.""" + + # Print out. + print('') + print("#######################################################") + print("# Checking for replicated titles in the LaTeX sources #") + print("#######################################################\n\n") + + # Import the find_replicate_titles module (needs to be done here so that Sconstruct doesn't need to load the entire program each time). + sys.path.append(getcwd()) + from docs.latex.find_replicate_titles import Replicated_titles + + # Find the replicates. + replicates = Replicated_titles() + if replicates.find(): + print("\n\nFatal error: Replicated titles found.") + print("\n\n\n") + sys.exit(1) + + # Delete the Replicate_titles class. This allows the loaded dll files to be deleted through python on MS Windows. + del replicates + del Replicate_titles + + # Final printout. + print("\n\n\n") + + def version_file(target, source, env): """Builder action for creating the LaTeX relax version file.""" Modified: trunk/sconstruct URL: http://svn.gna.org/viewcvs/relax/trunk/sconstruct?rev=28057&r1=28056&r2=28057&view=diff ============================================================================== --- trunk/sconstruct (original) +++ trunk/sconstruct Thu Oct 15 11:44:13 2015 @@ -4,7 +4,7 @@ ############################################################################### # # -# Copyright (C) 2006-2014 Edward d'Auvergne # +# Copyright (C) 2006-2015 Edward d'Auvergne # # Copyright (C) 2014 Troels E. Linnet # # # # This file is part of the program relax (http://www.nmr-relax.com). # @@ -37,7 +37,7 @@ # Scons modules. from scons.distrib import package, gpg_sign from scons.install import install, uninstall -from scons.manuals import clean_manual_files, compile_api_manual_html, compile_user_manual_html, compile_user_manual_pdf, fetch_docstrings, version_file +from scons.manuals import clean_manual_files, compile_api_manual_html, compile_user_manual_html, compile_user_manual_pdf, fetch_docstrings, replicate_title_check, version_file from SCons.Script import ARGUMENTS import SCons.Util @@ -306,6 +306,7 @@ manual_env.Manual(target='user_manual_pdf', source=None) manual_env.Depends('user_manual_pdf', 'manual_clean') manual_env.Depends('user_manual_pdf', 'manual_version_file') + manual_env.Depends('user_manual_pdf', 'replicate_title_check') manual_env.Depends('user_manual_pdf', 'fetch_docstrings') manual_env.Depends('user_manual_pdf', 'compile_user_manual_pdf') @@ -313,12 +314,14 @@ manual_env.Manual(target='user_manual_pdf_nofetch', source=None) manual_env.Depends('user_manual_pdf_nofetch', 'manual_clean') manual_env.Depends('user_manual_pdf_nofetch', 'manual_version_file') + manual_env.Depends('user_manual_pdf_nofetch', 'replicate_title_check') manual_env.Depends('user_manual_pdf_nofetch', 'compile_user_manual_pdf') # Target for creating the user manual (HTML version). manual_env.Manual(target='user_manual_html', source=None) manual_env.Depends('user_manual_html', 'manual_clean') manual_env.Depends('user_manual_html', 'manual_version_file') + manual_env.Depends('user_manual_html', 'replicate_title_check') manual_env.Depends('user_manual_html', 'fetch_docstrings') manual_env.Depends('user_manual_html', 'compile_user_manual_html') @@ -326,6 +329,7 @@ manual_env.Manual(target='user_manual_html_nofetch', source=None) manual_env.Depends('user_manual_html_nofetch', 'manual_clean') manual_env.Depends('user_manual_html_nofetch', 'manual_version_file') + manual_env.Depends('user_manual_html_nofetch', 'replicate_title_check') manual_env.Depends('user_manual_html_nofetch', 'compile_user_manual_html') # Target for creating the API documentation manual (HTML version). @@ -337,6 +341,10 @@ # Target for creating relax version number LaTeX file. manual_env.Append(BUILDERS={'Version' : Builder(action=version_file)}) manual_env.Version(target='manual_version_file', source=None) + + # Target for checking for replicated titles. + manual_env.Append(BUILDERS={'Replicate' : Builder(action=replicate_title_check)}) + manual_env.Replicate(target='replicate_title_check', source=None) # Target for fetching the docstrings. manual_env.Append(BUILDERS={'Fetch' : Builder(action=fetch_docstrings)}) @@ -547,6 +555,7 @@ string = string + ' %-25s%-40s\n' % ('gpg_src', 'GPG sign the source distribution file') string = string + ' %-25s%-40s\n' % ('version_check', 'check the relax version number') string = string + ' %-25s%-40s\n' % ('manual_version_file', 'create the relax version number LaTeX file') + string = string + ' %-25s%-40s\n' % ('replicate_title_check', 'check for replicated titles in the LaTeX sources') string = string + ' %-25s%-40s\n' % ('fetch_docstrings', 'fetch and LaTeX format the docstrings') string = string + ' %-25s%-40s\n' % ('compile_user_manual_pdf', 'compile the PDF version of the user manual from the LaTeX sources') string = string + ' %-25s%-40s\n' % ('compile_user_manual_html', 'compile the HTML version of the user manual from the LaTeX sources')