Source

treedo / setup.py

from distutils.core import setup
from treedo import __version__, __author__
import os
import sys

APP_TITLE = 'TreeDo'
extra = {}

if 'py2app' in sys.argv and sys.platform == 'darwin':
    from upx import Py2App

    options = dict(
        iconfile='treedo/res/treedo.icns',
        compressed=1,
        optimize=1,
        plist=dict(
            CFBundleName=APP_TITLE,
            CFBundleShortVersionString=__version__,
            CFBundleGetInfoString='%s %s' % (APP_TITLE, __version__),
            CFBundleExecutable=APP_TITLE,
            CFBundleIdentifier='com.codekoala.treedo',
        ),
        packages=[
            'lxml',
        ],
        frameworks=[
            '/usr/lib/libxml2.2.7.3.dylib',
        ],
        includes=[
            'gzip',
        ],
    )
    extra = dict(
        app=['treedo/treedo.py'],
        options=dict(py2app=options),
        setup_requires=[
            'py2app',
            'lxml',
        ],
        cmdclass={
            'py2app': Py2App,
        }
    )

elif 'py2exe' in sys.argv and sys.platform in ('nt', 'win32'):
    from upx import Py2Exe

    class Target(object):
        def __init__(self, **kw):
            self.__dict__.update(kw)

            # for the versioninfo resources
            self.version = __version__
            self.company_name = __author__
            self.copyright = "2009-10 (c) %s" % __author__
            self.name = APP_TITLE

    manifest_template = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="5.0.0.0"
    processorArchitecture="x86"
    name="%(prog)s"
    type="win32"
/>
<description>%(prog)s Program</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>
'''

    RT_MANIFEST = 24

    target = Target(
        # used for the versioninfo resource
        description=description,
        script='treedo/treedo.py',
        other_resources=[
            (RT_MANIFEST, 1, manifest_template % dict(prog=APP_TITLE))
        ],
        icon_resources=[(1, 'treedo/res/treedo.ico')],
        dest_base='treedo')

    options={
        'py2exe': {
            'typelibs': [
                # typelib for WMI
                ('{565783C6-CB41-11D1-8B02-00600806D9B6}', 0, 1, 2),
            ],
            'compressed': 1,
            'optimize': 0,
            'bundle_files': 1,
            'includes': [
            ],
        }
    }

    extra = dict(
        windows=[target],
    )

setup(
    name='treedo',
    version=__version__,
    description='A Python and XML-based todo list.',
    long_description=open('README', 'r').read(),
    keywords='todo, python, xml, lxml',
    author=__author__,
    author_email='codekoala at gmail com',
    license='BSD',
    package_dir={'treedo': 'treedo'},
    packages=['treedo'],
    platforms=['Windows', 'Linux', 'OSX'],
    scripts=[
        'treedo/scripts/treedo',
    ],
    data_files=[
        ('.', (
            'README',
            'LICENSE',
        )),
        ('res', (
            'treedo/res/add_subtask.png',
            'treedo/res/add.png',
            'treedo/res/collapse.png',
            'treedo/res/expand.png',
            'treedo/res/save.jpg',
        )),
    ],
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Console",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: BSD License",
        "Natural Language :: English",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.5",
        "Programming Language :: Python :: 2.6",
        "Topic :: Utilities",
    ],
    **extra
)