setup.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import os
00004 import platform
00005 import sys
00006 import warnings
00007 
00008 from distutils.core import setup, Extension
00009 from catkin_pkg.python_setup import generate_distutils_setup
00010 
00011 d = generate_distutils_setup(
00012     packages=[
00013         'rosbridge_server',
00014         'backports',
00015         'backports.ssl_match_hostname',
00016         'tornado',
00017         'tornado.platform'
00018     ],
00019     package_dir={'': 'src'}
00020 )
00021 
00022 # The following code is copied from
00023 # https://github.com/mongodb/mongo-python-driver/blob/master/setup.py
00024 # to support installing without the extension on platforms where
00025 # no compiler is available.
00026 from distutils.command.build_ext import build_ext
00027 
00028 class custom_build_ext(build_ext):
00029     """Allow C extension building to fail.
00030 
00031     The C extension speeds up websocket masking, but is not essential.
00032     """
00033 
00034     warning_message = """
00035 ********************************************************************
00036 WARNING: %s could not
00037 be compiled. No C extensions are essential for Tornado to run,
00038 although they do result in significant speed improvements for
00039 websockets.
00040 %s
00041 
00042 Here are some hints for popular operating systems:
00043 
00044 If you are seeing this message on Linux you probably need to
00045 install GCC and/or the Python development package for your
00046 version of Python.
00047 
00048 Debian and Ubuntu users should issue the following command:
00049 
00050     $ sudo apt-get install build-essential python-dev
00051 
00052 RedHat, CentOS, and Fedora users should issue the following command:
00053 
00054     $ sudo yum install gcc python-devel
00055 ********************************************************************
00056 """
00057 
00058     def run(self):
00059         try:
00060             build_ext.run(self)
00061         except Exception:
00062             e = sys.exc_info()[1]
00063             sys.stdout.write('%s\n' % str(e))
00064             warnings.warn(self.warning_message % ("Extension modules",
00065                                                   "There was an issue with "
00066                                                   "your platform configuration"
00067                                                   " - see above."))
00068 
00069     def build_extension(self, ext):
00070         name = ext.name
00071         try:
00072             build_ext.build_extension(self, ext)
00073         except Exception:
00074             e = sys.exc_info()[1]
00075             sys.stdout.write('%s\n' % str(e))
00076             warnings.warn(self.warning_message % ("The %s extension "
00077                                                   "module" % (name,),
00078                                                   "The output above "
00079                                                   "this warning shows how "
00080                                                   "the compilation "
00081                                                   "failed."))
00082 
00083 if (platform.python_implementation() == 'CPython' and
00084     os.environ.get('TORNADO_EXTENSION') != '0'):
00085     # This extension builds and works on pypy as well, although pypy's jit
00086     # produces equivalent performance.
00087     d['ext_modules'] = [
00088         Extension('tornado.speedups', sources=['src/tornado/speedups.c']),
00089     ]
00090 
00091     if os.environ.get('TORNADO_EXTENSION') != '1':
00092         # Unless the user has specified that the extension is mandatory,
00093         # fall back to the pure-python implementation on any build failure.
00094         d['cmdclass'] = {'build_ext': custom_build_ext}
00095 
00096 setup(**d)


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Thu Aug 27 2015 14:50:40