# HG changeset patch # User Jeff Hammel # Date 1300138326 25200 # Node ID 230fb4ae30c7cb610f03376c07457f2077751d69 # Parent 0cd9a1362310af5578d478030b296ed71805b4c3 look for PIL dynamically when running setup.py diff -r 0cd9a1362310 -r 230fb4ae30c7 setup.py --- a/setup.py Mon Dec 13 20:08:15 2010 -0800 +++ b/setup.py Mon Mar 14 14:32:06 2011 -0700 @@ -1,5 +1,6 @@ from setuptools import setup, find_packages -import sys, os +from pkg_resources import require, DistributionNotFound +import os try: filename = os.path.join(os.path.dirname(__file__), 'README.txt') @@ -7,7 +8,18 @@ except: description = '' -version = '0.1.5' +# Dependency check at run time +# If PIL is not found, then it is added in the ``install_requires`` list +install_requires = [] # Empty list if PIL is found +try: + try: + require('PIL') + except DistributionNotFound: + require('Image') +except DistributionNotFound: + install_requires = ['PIL'] + +version = '0.1.6' setup(name='cropresize', version=version, @@ -22,13 +34,7 @@ packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, - install_requires=[ - # -*- Extra requirements: -*- - 'PIL', - ], - dependency_links=[ - "http://dist.repoze.org/PIL-1.1.6.tar.gz", - ], + install_requires=install_requires, entry_points=""" # -*- Entry points: -*- [console_scripts]