setup.py
Go to the documentation of this file.
00001 # Work around mbcs bug in distutils.
00002 # http://bugs.python.org/issue10945
00003 import codecs
00004 try:
00005     codecs.lookup('mbcs')
00006 except LookupError:
00007     ascii = codecs.lookup('ascii')
00008     func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
00009     codecs.register(func)
00010 
00011 from distutils.core import setup, Extension
00012 import glob, os, shutil, fnmatch, platform
00013 
00014 version = '1.1.61'
00015 
00016 from generator import mavgen, mavparse
00017 
00018 # path to message_definitions directory
00019 mdef_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'message_definitions')
00020 dialects_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dialects')
00021 
00022 v09_dialects = glob.glob(os.path.join(mdef_path, 'v0.9', '*.xml'))
00023 v10_dialects = glob.glob(os.path.join(mdef_path, 'v1.0', '*.xml'))
00024 
00025 v09_dialects
00026 
00027 if not "NOGEN" in os.environ:
00028     for xml in v09_dialects:
00029         shutil.copy(xml, os.path.join(dialects_path, 'v09'))
00030     for xml in v10_dialects:
00031         shutil.copy(xml, os.path.join(dialects_path, 'v10'))
00032 
00033     for xml in v09_dialects:
00034         dialect = os.path.basename(xml)[:-4]
00035         wildcard = os.getenv("MAVLINK_DIALECT",'*')
00036         if not fnmatch.fnmatch(dialect, wildcard):
00037             continue
00038         print("Building %s" % xml)
00039         mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_0_9)
00040 
00041     for xml in v10_dialects:
00042         dialect = os.path.basename(xml)[:-4]
00043         wildcard = os.getenv("MAVLINK_DIALECT",'*')
00044         if not fnmatch.fnmatch(dialect, wildcard):
00045             continue
00046         print("Building %s" % xml)
00047         mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0)
00048 
00049 extensions = [] # Assume we might be unable to build native code
00050 if platform.system() != 'Windows':
00051     extensions = [ Extension('mavnative',
00052                     sources = ['mavnative/mavnative.c'],
00053                     include_dirs = [
00054                         'generator/C/include_v1.0',
00055                         'mavnative'
00056                         ]
00057                     ) ]
00058 else:
00059     print("Skipping mavnative due to Windows possibly missing a compiler...")
00060 
00061 setup (name = 'pymavlink',
00062        version = version,
00063        description = 'Python MAVLink code',
00064        long_description = '''A Python library for handling MAVLink protocol streams and log files. This allows for the creation of simple scripts to analyse telemetry logs from autopilots such as ArduPilot which use the MAVLink protocol. See the scripts that come with the package for examples of small, useful scripts that use pymavlink. For more information about the MAVLink protocol see http://qgroundcontrol.org/mavlink/''',
00065        url = 'http://github.com/mavlink/mavlink',
00066        classifiers=['Development Status :: 4 - Beta',
00067                     'Environment :: Console',
00068                     'Intended Audience :: Science/Research',
00069                     'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
00070                     'Operating System :: OS Independent',
00071                     'Programming Language :: Python :: 2.7',
00072                     'Topic :: Scientific/Engineering'
00073                     ],
00074        license='LGPLv3',
00075        package_dir = { 'pymavlink' : '.' },
00076        package_data = { 'pymavlink.dialects.v09' : ['*.xml'],
00077                         'pymavlink.dialects.v10' : ['*.xml'],
00078                         'pymavlink.generator'    : [ '*.xsd',
00079                                                      'java/lib/*.*',
00080                                                      'java/lib/Messages/*.*',
00081                                                      'C/include_v0.9/*.h',
00082                                                      'C/include_v1.0/*.h',
00083                                                      'C/include_v1.0/*.hpp' ],
00084                         'pymavlink.generator.lib.minixsv': [ '*.xsd' ],
00085                         'pymavlink' : ['mavnative/*.h'] },
00086        packages = ['pymavlink',
00087                    'pymavlink.generator',
00088                    'pymavlink.generator.lib',
00089                    'pymavlink.generator.lib.genxmlif',
00090                    'pymavlink.generator.lib.minixsv',
00091                    'pymavlink.dialects',
00092                    'pymavlink.dialects.v09',
00093                    'pymavlink.dialects.v10'],
00094        scripts = [ 'tools/magfit_delta.py', 'tools/mavextract.py',
00095                    'tools/mavgraph.py', 'tools/mavparmdiff.py',
00096                    'tools/mavtogpx.py', 'tools/magfit_gps.py',
00097                    'tools/mavflightmodes.py', 'tools/mavlogdump.py',
00098                    'tools/mavparms.py', 'tools/magfit_motors.py',
00099                    'tools/mavflighttime.py', 'tools/mavloss.py',
00100                    'tools/mavplayback.py', 'tools/magfit.py',
00101                    'tools/mavgpslock.py',
00102                    'tools/mavmission.py',
00103                    'tools/mavsigloss.py',
00104                    'tools/mavsearch.py',
00105                    'tools/mavtomfile.py',
00106                    'tools/mavgen.py',
00107                    'tools/mavkml.py',
00108                    'tools/mavfft.py',
00109                    'tools/mavsummarize.py',
00110                    'tools/MPU6KSearch.py'],
00111        ext_modules = extensions
00112        )


mavlink
Author(s): Lorenz Meier
autogenerated on Wed Sep 9 2015 18:06:17