Пример #1
0
def check(f, lines):
    if f.fileType != "tex":
        return None
    if tools.isGnuplotLatexFile(lines):
        return None
    dependencies = []
    starts = []
    target = f.fname
    for l in lines:
        if "\\includegraphics" in l and "{" in l and "}" in l:
            filename = tools.charactersBetween(l, "{", "}")
            if fileUtils.getFileType(filename) is None or fileUtils.getFileType(filename) == "":
                possibleExtensions = [".png", ".bmp", ".gif", ".jpg", ".pdf"]
                possibleExtensions = possibleExtensions + [x.upper() for x in possibleExtensions]
                found = False
                for fileEnding in possibleExtensions:
                    if os.path.isfile(filename + fileEnding):
                        logging.info("Found a file named " + filename + fileEnding + ", will assume that this file is meant by")
                        logging.info(l.replace("\n", ""))
                        filename = filename + fileEnding
                        found = True
                        break
                if not found:
                    logging.info("Didn't find a file with this name, ignoring this dependency:" + str(l.replace("\n", "")))
                    continue
            starts.append(filename)
    if len(starts) == 0:
        return None
    return Dependency(starts = starts, targets = target, runCommandOnStartFile = False, printOutput = False)
Пример #2
0
def check(f, lines):
    """Checks if the given tex file is one that will actually compile to a pdf. If it isn't, we probably don't want to run pdflatex on it either."""
    if f.fileType != "tex":
        return None
    if tools.isGnuplotLatexFile(lines):
        return None
    start = f.fname
    target = f.fname.replace(".tex","." + config.latexOutputFormat)
    for l in lines:
        if "\\begin{document}" in l:
            return Dependency(starts = start, targets = target, command = config.latexCommand + " " + config.startFilePlaceholder, runInStartFolder = True, printOutput = True)
    return None
Пример #3
0
def check(f, lines):
    if f.fileType != "tex":
        return None
    if tools.isGnuplotLatexFile(lines):
        return None
    dependencies = []
    starts = []
    target = f.fname
    for l in lines:
        if "input" in l:
            filename = tools.charactersBetween(l, "{", "}")
            starts.append(filename + ".tex")
    if len(starts) == 0:
        return None
    return Dependency(starts = starts, targets = target, runCommandOnStartFile = False, printOutput = False)
Пример #4
0
def check(f, lines):
    if f.fileType != "tex":
        return None
    if tools.isGnuplotLatexFile(lines):
        return None
    dependencies = []
    starts = []
    target = f.fname
    for l in lines:
        if "subimport" in l:
            path = tools.charactersBetween(l, "{", "}")
            fname = tools.charactersBetween(l, "{", "}", l.find(path))
            filename = path + fname
            starts.append(filename + ".tex")
    if len(starts) == 0:
        return None
    return Dependency(starts=starts, targets=target, runInStartFolder=False, printOutput=False)