This package contains the source for PdfMasher. To learn how to build it, refer to the "Build PdfMasher" section. Below is the description of the various subfolders:
- core: Contains the core logic code for PdfMasher. Written in Python.
- cocoa: UI code for the Cocoa toolkit. It's Objective-C code.
- qt: UI code for the Qt toolkit. It's written in Python and uses PyQt.
- images: Images used by the different UI codebases.
- debian_*: Skeleton files required to create a .deb package
- help: Help document, written for Sphinx.
There are also other sub-folder that comes from external repositories (automatically checked out with as mercurial subrepos):
- hscommon: A collection of helpers used across HS applications.
- cocoalib: A collection of helpers used across Cocoa UI codebases of HS applications.
- qtlib: A collection of helpers used across Qt UI codebases of HS applications.
Before being able to build PdfMasher, a few dependencies have to be installed:
- Python 3.2 (http://www.python.org)
- pdfminer3k (http://hg.hardcoded.net/pdfminer3k)
- jobprogress 1.0.0 (http://hg.hardcoded.net/jobprogress)
- Sphinx 1.0.7 (http://sphinx.pocoo.org/)
- pytest 2.0.3, to run unit tests. (http://pytest.org/)
- Markdown 2.0.3 (http://www.freewisdom.org/projects/python-markdown)
Note: Sphinx doesn't officially support Python 3.x yet, but it doesn't matter because it is invoked by the build system through command line, so you can build PdfMasher even if Sphinx is installed in your Python 2.x install.
Note 2: I include a copy of markdown in the source tree because at this time, although Markdown supports Python 3, the version of PyPI doesn't work and one has to download the source, manually apply 2to3 on it, and then install. Until Markdown is easier to install, I'll just put a copy of it in here.
OS X prerequisites
- XCode 4 (http://developer.apple.com/xcode/)
- Sparkle (http://sparkle.andymatuschak.org/)
- PyObjC 2.3 (http://pyobjc.sourceforge.net/)
- pluginbuilder 1.0.1 (http://bitbucket.org/hsoft/pluginbuilder)
- Visual Studio 2008 (Express is enough) is needed to build C extensions. (http://www.microsoft.com/Express/)
- PyQt 4.7.5 (http://www.riverbankcomputing.co.uk/news)
- cx_Freeze, if you want to build a exe. You don't need it if you just want to run PdfMasher. (http://cx-freeze.sourceforge.net/)
- Advanced Installer, if you want to build the installer file. (http://www.advancedinstaller.com/)
- PyQt 4.7.5 (http://www.riverbankcomputing.co.uk/news)
The easy way!
There's an easy way to install the majority of the prerequisites above, and it's pip (http://www.pip-installer.org/) which has recently started to support Python 3. So install it and then run::
pip install -r requirements-[osx|win|lnx].txt
([osx|win|lnx] depends, of course, on your platform). Because Sphinx doesn't support Python 3 yet, it's not in the requirements file and you'll have to install it manually. You might have to compile PyObjC manually too (see gotchas below). Sparkle and Advanced Installer, having nothing to do with Python, are also manual installs. PyQt also needs to be installed manually: the package is on PyPI, but there's no download available.
Correctly installing the prerequisites is tricky. Make sure you have at least the version number required for each prerequisite.
If you didn't use mercurial to download this source, you probably have an incomplete source folder! External projects (hscommon, qtlib, cocoalib) need to be at the root of the PdfMasher project folder. You'll have to download those separately. Or use mercurial, it's much easier.
As far as I can tell, you don't have to compile/install everything manually and you can normally
easy_install to install python dependencies. However, be aware that compiling/installing
manually from the repositories of each project is what I personally do, so if you hit a snag
somewhere, you might want to try the manual way.
PyObjC's website is badly outdated. Also, as far as I can tell, the package installable with
easy_install has good chances of not working. Your best bet is to download the latest tagged
version from the repository and compile it from source.
Also, on OS X, don't try to use the built-in python 2.x to install Sphinx on (the only pre-requisite that doesn't run on python 3 yet). There's some weird error popping up when PdfMasher tries to build its help file. Install your own framework version of python 2.7, and then install Sphinx on that. When Sphinx supports Python 3, things will be easier because you'll be able to install sphinx on the same Python version you build PdfMasher with.
Another one on OS X: I wouldn't use macports/fink/whatever. Whenever I tried using those, I always ended up with problems.
Also, I don't know yet if it's possible to compile PdfMasher with XCode 4, I haven't tried it yet. It's safer to use XCode 3.x. However, I don't see why it wouldn't work, so it very well might work.
Whenever you have a problem, always double-check that you're running the correct python version. You'll probably have to tweak your $PATH.
First, make sure you meet the dependencies listed in the section above. Then you need to configure your build with:
If you want, you can specify a UI to use with the
--ui option. So, if you want to build PdfMasher
with Qt on OS X, then you have to type
python configure.py --ui=qt. You can also use the
flag to indicate a dev build (it will build
pyplugin.plugin in alias mode and use the "dev" config
Then, just build the thing and then run it with:
python build.py python run.py
If you want to create ready-to-upload package, run: