Reviewers: , Message: If we want to retain this functionality, I will implement this via importlib.util.spec_from_file_location() + importlib.util.module_from_spec(). But I would like to keep complexity to a minimum, hence remove unused functionality.
Description: lilypond-book: Remove custom package loading AFAICT this feature is not documented and only used for the musicxml testsuite. However the output of the formatter in the loaded module book-musicxml-testsuite.py only differs by whitespace from the default. (This also gets rid of the deprecation warning for module 'imp'.) Please review this at https://codereview.appspot.com/553490051/ Affected files (+0, -81 lines): M input/regression/musicxml/GNUmakefile D input/regression/musicxml/book-musicxml-testsuite.py M scripts/lilypond-book.py Index: input/regression/musicxml/book-musicxml-testsuite.py diff --git a/input/regression/musicxml/book-musicxml-testsuite.py b/input/regression/musicxml/book-musicxml-testsuite.py deleted file mode 100644 index a292db5489a5c72cf894266c133e40ddbae8ad4d..0000000000000000000000000000000000000000 --- a/input/regression/musicxml/book-musicxml-testsuite.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- - -import book_base as BookBase -import book_texinfo as BookTexinfo -import book_snippets as BookSnippet -import lilylib as ly - -MusicXMLOutputImage = r'''@noindent -@ifinfo -@image{%(info_image_path)s,,,%(alt)s,%(ext)s} -@end ifinfo -@html -<p> - <a href="%(base)s%(ext)s"> - <img align="middle" border="0" src="%(image)s" alt="%(alt)s"> - </a> -</p> -@end html -''' - -MusicXMLOutput = r''' -@iftex -@include %(base)s-systems.texi -@end iftex -''' - -MusicXMLPrintFilename = r''' -@html -<a href="%(base)s%(ext)s"> -@end html -@file{%(filename)s} -@html -</a> -@end html -''' - - - - -class BookMusicXML (BookTexinfo.BookTexinfoOutputFormat): - def __init__ (self): - BookTexinfo.BookTexinfoOutputFormat.__init__ (self) - self.format = "MusicXMLTest" - self.output[BookBase.OUTPUTIMAGE] = MusicXMLOutputImage - self.output[BookBase.OUTPUT] = MusicXMLOutput - self.output[BookBase.PRINTFILENAME] = MusicXMLPrintFilename - def snippet_class (self, type): - if type == "musicxml_file": - return MusicXMLTestSuiteSnippet - else: - return BookSnippet.snippet_type_to_class.get (type, BookSnippet.Snippet) - def snippet_output (self, basename, snippet): - return BookTexinfo.BookTexinfoOutputFormat.snippet_output (self, basename, snippet) - - -class MusicXMLTestSuiteSnippet (BookSnippet.MusicXMLFileSnippet): - def __init__ (self, type, match, formatter, line_number, global_options): - BookSnippet.MusicXMLFileSnippet.__init__ (self, type, match, formatter, line_number, global_options) - -## TODO: Customize output with renderings from other MusicXML-supporting -# applications. Also add some link to the intermediate .ly file - - -BookBase.register_format (BookMusicXML ()); Index: input/regression/musicxml/GNUmakefile diff --git a/input/regression/musicxml/GNUmakefile b/input/regression/musicxml/GNUmakefile index 8de07eedd99e196e2977243dc80b2008faed8d03..d469d08c2f77c704d5b41d54afe3b606efb75891 100644 --- a/input/regression/musicxml/GNUmakefile +++ b/input/regression/musicxml/GNUmakefile @@ -14,9 +14,6 @@ include $(depth)/make/stepmake.make TITLE=Unofficial MusicXML test suite AUTHOR=Reinhold Kainhofer TEST_SUITE_VERSION=0.1 -LILYPOND_BOOK_FLAGS += --load-custom-package=$(src-dir)/book-musicxml-testsuite.py -# This breaks since *.tex and *.texi still contains ac/lily-xxxxxx references! -#LILYPOND_BOOK_FLAGS += --use-source-file-names ifeq ($(out),www) local-WWW-2: zip Index: scripts/lilypond-book.py diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 1ffe3fa4779d0405b82cf82667e20ad012f69ca0..9e445676e2db556f3bfe9461cc17c31452362311 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -52,7 +52,6 @@ import re import stat import sys import tempfile -import imp from optparse import OptionGroup from functools import reduce @@ -172,11 +171,6 @@ def get_option_parser (): action='store', dest='lily_output_dir', default=None) - p.add_option ('--load-custom-package', help=_ ("Load the additional python PACKAGE (containing e.g. a custom output format)"), - metavar=_ ("PACKAGE"), - action='append', dest='custom_packages', - default=[]) - p.add_option ("-l", "--loglevel", help=_ ("Print log messages according to LOGLEVEL " "(NONE, ERROR, WARNING, PROGRESS (default), DEBUG)"), @@ -673,14 +667,6 @@ def do_options (): global_options.include_path.insert (0, "./") - # Load the python packages (containing e.g. custom formatter classes) - # passed on the command line - nr = 0 - for i in global_options.custom_packages: - nr += 1 - progress (str(imp.load_source ("book_custom_package%s" % nr, i))) - - if global_options.warranty: warranty () exit (0)