#!/usr/bin/env python from imp import load_source from os import path from sys import argv CLASSIFIERS = [ 'Intended Audience :: Developers', 'Development Status :: 5 - Production/Stable', 'Environment :: Console :: Curses', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: OS Independent', 'Natural Language :: English', 'Programming Language :: Python'] def getLongDescription(): try: return open('README').read() except IOError: pass from README import writeReadme from StringIO import StringIO out = StringIO() writeReadme(out) out.seek(0) return out.read() def main(): if "--setuptools" in argv: argv.remove("--setuptools") from setuptools import setup use_setuptools = True else: from distutils.core import setup use_setuptools = False hachoir_editor = load_source("version", path.join("hachoir_editor", "version.py")) PACKAGES = {"hachoir_editor": "hachoir_editor"} install_options = { "name": hachoir_editor.PACKAGE, "version": hachoir_editor.__version__, "url": hachoir_editor.WEBSITE, "download_url": hachoir_editor.WEBSITE, "author": "Hachoir team (see AUTHORS file)", "description": "Package of Hachoir editors used to open binary files", "long_description": getLongDescription(), "classifiers": CLASSIFIERS, "license": hachoir_editor.LICENSE, "packages": PACKAGES.keys(), "package_dir": PACKAGES, } if use_setuptools: install_options["install_requires"] = "hachoir-core>=1.2.1" install_options["zip_safe"] = True setup(**install_options) if __name__ == "__main__": main()