From 46a80d2b8fbaf4a880ca8f7ff460efac3793a4cd Mon Sep 17 00:00:00 2001 From: Luthaf Date: Mon, 7 Jul 2014 15:08:27 +0100 Subject: [PATCH] PDF compilation now works on windows --- Requirements.txt | 1 + patacrep/build.py | 20 ++++++++++++++------ setup.py | 26 ++++++-------------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Requirements.txt b/Requirements.txt index 40527bcd..9678473f 100644 --- a/Requirements.txt +++ b/Requirements.txt @@ -1,4 +1,5 @@ Jinja2==2.7.3 argparse==1.2.1 chardet==2.2.1 +unidecode>=0.04.16 https://github.com/tiarno/plastex/archive/master.zip \ No newline at end of file diff --git a/patacrep/build.py b/patacrep/build.py index dc5cdda0..d8f2735f 100755 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -148,6 +148,8 @@ class SongbookBuilder(object): self._pdflatex_options.append("--shell-escape") if not self.interactive: self._pdflatex_options.append("-halt-on-error") + for datadir in self.songbook.config["datadir"]: + self._pdflatex_options.append('--include-directory="{}"'.format(datadir)) def build_steps(self, steps=None): """Perform steps on the songbook by calling relevant self.build_*() @@ -192,12 +194,18 @@ class SongbookBuilder(object): """Build .pdf file from .tex file""" LOGGER.info("Building '{}.pdf'…".format(self.basename)) self._run_once(self._set_latex) - process = Popen( - ["pdflatex"] + self._pdflatex_options + [self.basename], - stdin=PIPE, - stdout=PIPE, - stderr=PIPE, - env=os.environ) + + try: + process = Popen( + ["pdflatex"] + self._pdflatex_options + [self.basename], + stdin=PIPE, + stdout=PIPE, + stderr=PIPE, + env=os.environ) + except Exception as e: + LOGGER.debug(e) + raise errors.LatexCompilationError(self.basename) + if not self.interactive: process.stdin.close() log = '' diff --git a/setup.py b/setup.py index b1829f10..4a6a797c 100755 --- a/setup.py +++ b/setup.py @@ -6,6 +6,8 @@ $ python setup.py install """ from patacrep import __STR_VERSION__ +from distutils.core import setup + import sys import os import site @@ -17,7 +19,7 @@ SETUP = {"name": 'patacrep', "author": 'The Songbook team', "author_email": 'crep@team-on-fire.com', "url": 'https://github.com/patacrep/patacrep', - "packages": ['patacrep'], + "packages": ['patacrep', 'patacrep.content'], "license": "GPLv2 or any later version", "scripts": ['songbook'], "requires": [ @@ -48,24 +50,8 @@ SETUP = {"name": 'patacrep', } if sys.platform.startswith('win32'): - try: - from cx_Freeze import setup, Executable - exe = Executable(script="songbook") - except ImportError: - # Only a source installation will be possible - from distutils.core import setup - exe = None - build_options = {'build_exe': { - "include_files": ["plasTeX/", "patacrep/"], - "excludes": ["plasTeX"], - "includes": ["UserList", "UserString", "new", "ConfigParser"] - }} - SETUP.update({"options": build_options, - "executables": [exe], - "package_data": {}, - }) -else: - from distutils.core import setup - + from shutil import copy + copy("songbook", "songbook.py") + SETUP["scripts"] = ['songbook.py'] setup(**SETUP)