| 1 |
try: |
|---|
| 2 |
from setuptools import setup, Extension |
|---|
| 3 |
except ImportError: |
|---|
| 4 |
from distutils.core import setup, Extension |
|---|
| 5 |
import sys |
|---|
| 6 |
from distutils.command.build_ext import build_ext |
|---|
| 7 |
from distutils.errors import DistutilsPlatformError, CCompilerError |
|---|
| 8 |
|
|---|
| 9 |
class optional_build_ext(build_ext): |
|---|
| 10 |
# This class allows C extension building to fail. |
|---|
| 11 |
def run(self): |
|---|
| 12 |
try: |
|---|
| 13 |
build_ext.run(self) |
|---|
| 14 |
except DistutilsPlatformError: |
|---|
| 15 |
self._unavailable() |
|---|
| 16 |
|
|---|
| 17 |
def build_extension(self, ext): |
|---|
| 18 |
try: |
|---|
| 19 |
build_ext.build_extension(self, ext) |
|---|
| 20 |
except CCompilerError, x: |
|---|
| 21 |
self._unavailable() |
|---|
| 22 |
|
|---|
| 23 |
def _unavailable(self): |
|---|
| 24 |
print '*' * 78 |
|---|
| 25 |
print """ |
|---|
| 26 |
WARNING: Could not compile C extension, contextual help will not be available. |
|---|
| 27 |
""" |
|---|
| 28 |
print '*' * 78 |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
ext_modules = [] |
|---|
| 32 |
install_requires = [] |
|---|
| 33 |
|
|---|
| 34 |
if 'win' in sys.platform: |
|---|
| 35 |
ext_modules = [] |
|---|
| 36 |
install_requires = ['pyreadline'] |
|---|
| 37 |
if sys.version_info[:2] < (2, 5): |
|---|
| 38 |
install_requires.append('ctypes') |
|---|
| 39 |
else: |
|---|
| 40 |
ext_modules = [Extension('cly._rlext', ['cly/_rlext.c'], |
|---|
| 41 |
libraries=['readline', 'curses'])] |
|---|
| 42 |
|
|---|
| 43 |
setup( |
|---|
| 44 |
name='cly', |
|---|
| 45 |
url='http://swapoff.org/cly', |
|---|
| 46 |
download_url='http://swapoff.org/cly', |
|---|
| 47 |
author='Alec Thomas', |
|---|
| 48 |
author_email='alec@swapoff.org', |
|---|
| 49 |
version='1.0', |
|---|
| 50 |
description='A module for adding powerful text-based consoles to your application.', |
|---|
| 51 |
long_description=\ |
|---|
| 52 |
"""CLY is a Python module for simplifying the creation of interactive shells. |
|---|
| 53 |
Kind of like the builtin "cmd" module on steroids.""", |
|---|
| 54 |
license='BSD', |
|---|
| 55 |
platforms=['any'], |
|---|
| 56 |
packages=['cly'], |
|---|
| 57 |
zip_safe=False, |
|---|
| 58 |
test_suite='cly.test.suite', |
|---|
| 59 |
classifiers=['Development Status :: 3 - Alpha', |
|---|
| 60 |
'Intended Audience :: Developers', |
|---|
| 61 |
'License :: OSI Approved :: BSD License', |
|---|
| 62 |
'Operating System :: OS Independent', |
|---|
| 63 |
'Topic :: System :: Shells', |
|---|
| 64 |
'Environment :: Console', |
|---|
| 65 |
'Topic :: Software Development :: Libraries'], |
|---|
| 66 |
ext_modules=ext_modules, |
|---|
| 67 |
install_requires=install_requires, |
|---|
| 68 |
cmdclass={'build_ext': optional_build_ext}, |
|---|
| 69 |
) |
|---|