Browse Source

PDF compilation now works on windows

pull/55/head
Luthaf 11 years ago
parent
commit
46a80d2b8f
  1. 1
      Requirements.txt
  2. 20
      patacrep/build.py
  3. 26
      setup.py

1
Requirements.txt

@ -1,4 +1,5 @@
Jinja2==2.7.3 Jinja2==2.7.3
argparse==1.2.1 argparse==1.2.1
chardet==2.2.1 chardet==2.2.1
unidecode>=0.04.16
https://github.com/tiarno/plastex/archive/master.zip https://github.com/tiarno/plastex/archive/master.zip

20
patacrep/build.py

@ -148,6 +148,8 @@ class SongbookBuilder(object):
self._pdflatex_options.append("--shell-escape") self._pdflatex_options.append("--shell-escape")
if not self.interactive: if not self.interactive:
self._pdflatex_options.append("-halt-on-error") 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): def build_steps(self, steps=None):
"""Perform steps on the songbook by calling relevant self.build_*() """Perform steps on the songbook by calling relevant self.build_*()
@ -192,12 +194,18 @@ class SongbookBuilder(object):
"""Build .pdf file from .tex file""" """Build .pdf file from .tex file"""
LOGGER.info("Building '{}.pdf'".format(self.basename)) LOGGER.info("Building '{}.pdf'".format(self.basename))
self._run_once(self._set_latex) self._run_once(self._set_latex)
process = Popen(
["pdflatex"] + self._pdflatex_options + [self.basename], try:
stdin=PIPE, process = Popen(
stdout=PIPE, ["pdflatex"] + self._pdflatex_options + [self.basename],
stderr=PIPE, stdin=PIPE,
env=os.environ) stdout=PIPE,
stderr=PIPE,
env=os.environ)
except Exception as e:
LOGGER.debug(e)
raise errors.LatexCompilationError(self.basename)
if not self.interactive: if not self.interactive:
process.stdin.close() process.stdin.close()
log = '' log = ''

26
setup.py

@ -6,6 +6,8 @@ $ python setup.py install
""" """
from patacrep import __STR_VERSION__ from patacrep import __STR_VERSION__
from distutils.core import setup
import sys import sys
import os import os
import site import site
@ -17,7 +19,7 @@ SETUP = {"name": 'patacrep',
"author": 'The Songbook team', "author": 'The Songbook team',
"author_email": 'crep@team-on-fire.com', "author_email": 'crep@team-on-fire.com',
"url": 'https://github.com/patacrep/patacrep', "url": 'https://github.com/patacrep/patacrep',
"packages": ['patacrep'], "packages": ['patacrep', 'patacrep.content'],
"license": "GPLv2 or any later version", "license": "GPLv2 or any later version",
"scripts": ['songbook'], "scripts": ['songbook'],
"requires": [ "requires": [
@ -48,24 +50,8 @@ SETUP = {"name": 'patacrep',
} }
if sys.platform.startswith('win32'): if sys.platform.startswith('win32'):
try: from shutil import copy
from cx_Freeze import setup, Executable copy("songbook", "songbook.py")
exe = Executable(script="songbook") SETUP["scripts"] = ['songbook.py']
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
setup(**SETUP) setup(**SETUP)

Loading…
Cancel
Save