From 6c2f91fbf88573caafe60d0a84835116cec8cd4c Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 3 Nov 2012 20:47:49 +0100 Subject: [PATCH] Template: Create instruments tex file only if we have any instruments --- generate_oly_score.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/generate_oly_score.py b/generate_oly_score.py index 047fb41..c614b03 100755 --- a/generate_oly_score.py +++ b/generate_oly_score.py @@ -478,14 +478,19 @@ def generate_tex_files (settings, lily_files): #this_settings["scorenamebase"] = "Name"; tex_files.append (write_texscore_file (settings, this_settings, "TeX_Score.tex", score)) - this_settings = copy.deepcopy (tex_settings); - this_settings["scoretype"] = "InstrumentalParts"; - tmpopts = this_settings.get ("tex_options", []) - tmpopts.append (tex_options_map.get (this_settings["scoretype"], "")) - this_settings["tex_options"] = tmpopts - if "createCriticalComments" not in tex_settings: - this_settings["createCriticalComments"] = score not in no_criticalcomments_scores; - tex_files.append (write_texscore_file (settings, this_settings, "TeX_Instruments.tex", "Instruments")) + + # Create the tex instruments file only if we have instruments! + if set(this_settings["instruments"]) != set(this_settings["noscore_instruments"]): + this_settings = copy.deepcopy (tex_settings); + this_settings["scoretype"] = "InstrumentalParts"; + tmpopts = this_settings.get ("tex_options", []) + tmpopts.append (tex_options_map.get (this_settings["scoretype"], "")) + this_settings["tex_options"] = tmpopts + if "createCriticalComments" not in tex_settings: + this_settings["createCriticalComments"] = score not in no_criticalcomments_scores; + tex_files.append (write_texscore_file (settings, this_settings, "TeX_Instruments.tex", "Instruments")) + else: + print " No separate instrumental scores, not creating instruments tex file." return [tex_files, tex_includes]; -- 2.11.4.GIT