changeset 134:0e18cdf36a0e

make the python package distutils compatible
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 19 Feb 2012 22:27:42 -0800
parents cd51ef9288ea
children f32ea241e94c
files makeitso/python_package/setup.py
diffstat 1 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/makeitso/python_package/setup.py	Thu Nov 03 11:00:01 2011 -0700
+++ b/makeitso/python_package/setup.py	Sun Feb 19 22:27:42 2012 -0800
@@ -1,15 +1,30 @@
+"""
+setup packaging script for {{project}}
+"""
+
 import os
-from setuptools import setup, find_packages
+
+version = "0.0"
+dependencies = {{dependencies}}
+
+# allow use of setuptools/distribue or distutils
+kw = {}
+try:
+    from setuptools import setup
+    kw['entry_points'] = """
+{{console_scripts}}
+"""
+    kw['install_requires'] = dependencies
+except ImportError:
+    from distutils.core import setup
+
 
 try:
     here = os.path.dirname(os.path.abspath(__file__))
     description = file(os.path.join(here, 'README.txt')).read()
-except IOError: 
+except IOError:
     description = ''
 
-version = "0.0"
-
-dependencies = {{dependencies}}
 
 setup(name='{{project}}',
       version=version,
@@ -20,14 +35,9 @@
       author_email='{{email}}',
       url='{{url}}',
       license='',
-      packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
+      packages=['{{project}}'],
       include_package_data=True,
       zip_safe=False,
       install_requires=dependencies,
-      entry_points="""
-      # -*- Entry points: -*-
-
-      {{console_scripts}}
-      """,
+      **kw
       )
-