Browse Source

Minor corrections

pull/20/head
Luthaf 11 years ago
parent
commit
4a99088923
  1. 21
      songbook/build.py
  2. 10
      songbook/files.py

21
songbook/build.py

@ -142,20 +142,18 @@ def makeTexFile(sb, library, output, core_dir):
# output template # output template
commentPattern = re.compile(r"^\s*%") commentPattern = re.compile(r"^\s*%")
f = open(template_dir+template) with open(template_dir+template) as f:
content = [ line for line in f if not commentPattern.match(line) ] content = [ line for line in f if not commentPattern.match(line) ]
for index, line in enumerate(content): for index, line in enumerate(content):
if re.compile("getLibraryImgDirectory").search(line): if re.compile("getLibraryImgDirectory").search(line):
line = line.replace("\\getLibraryImgDirectory", core_dir + "img/") line = line.replace("\\getLibraryImgDirectory", core_dir + "img/")
content[index] = line content[index] = line
if re.compile("getLibraryLilypondDirectory").search(line): if re.compile("getLibraryLilypondDirectory").search(line):
line = line.replace("\\getLibraryLilypondDirectory", core_dir + "lilypond/") line = line.replace("\\getLibraryLilypondDirectory", core_dir + "lilypond/")
content[index] = line content[index] = line
f.close()
out.write(''.join(content)) out.write(''.join(content))
out.close() out.close()
def buildsongbook(sb, basename, library): def buildsongbook(sb, basename, library):
@ -172,7 +170,6 @@ def buildsongbook(sb, basename, library):
CORE_DIR = MOD_DIR + '/../' CORE_DIR = MOD_DIR + '/../'
texFile = basename + ".tex" texFile = basename + ".tex"
pdfFile = basename + ".pdf"
# Make TeX file # Make TeX file
makeTexFile(sb, library, texFile, CORE_DIR) makeTexFile(sb, library, texFile, CORE_DIR)

10
songbook/files.py

@ -6,9 +6,9 @@ import fnmatch
import os import os
def recursiveFind(root_directory, pattern): def recursiveFind(root_directory, pattern):
matches = [] matches = []
for root, dirnames, filenames in os.walk(root_directory): for root, dirnames, filenames in os.walk(root_directory):
for filename in fnmatch.filter(filenames, pattern): for filename in fnmatch.filter(filenames, pattern):
matches.append(os.path.join(root, filename)) matches.append(os.path.join(root, filename))
return matches return matches

Loading…
Cancel
Save