Browse Source

PDF compilation now works on windows

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

1
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

8
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)
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 = ''

26
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)

Loading…
Cancel
Save