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

10
songbook/files.py

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

Loading…
Cancel
Save