| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
"""Setup script for libais""" |
| 4 |
|
| 5 |
import os |
| 6 |
import sys |
| 7 |
|
| 8 |
from setuptools import setup, find_packages, Extension |
| 9 |
|
| 10 |
|
| 11 |
with open('README.rst') as f: |
| 12 |
readme = f.read() |
| 13 |
|
| 14 |
|
| 15 |
with open(os.path.join('ais', '__init__.py')) as f: |
| 16 |
for line in f: |
| 17 |
if line.strip().startswith('__version__'): |
| 18 |
# Get version from line but leave as str: __version__ = "0.16" -> 0.16 |
| 19 |
VERSION = line.split('=')[1].strip()[1:-1].strip() |
| 20 |
break |
| 21 |
|
| 22 |
EXTRA_COMPILE_ARGS = [] |
| 23 |
if sys.platform in ('darwin', 'linux', 'linux2'): |
| 24 |
EXTRA_COMPILE_ARGS = ['-std=c++11'] |
| 25 |
|
| 26 |
|
| 27 |
AIS_MODULE = Extension( |
| 28 |
'_ais', |
| 29 |
extra_compile_args=EXTRA_COMPILE_ARGS, |
| 30 |
sources=[os.path.join('src', 'libais', fn) for fn in ( |
| 31 |
'ais_py.cpp', |
| 32 |
'ais.cpp', |
| 33 |
'ais_bitset.cpp', |
| 34 |
'ais1_2_3.cpp', # Class A position |
| 35 |
'ais4_11.cpp', # Basestation report, '=' - UTC time response |
| 36 |
'ais5.cpp', # Static data report / ship name |
| 37 |
'ais6.cpp', # Addressed binary message (ABM) |
| 38 |
'ais7_13.cpp', |
| 39 |
'ais8.cpp', # Broadcast binary message (BBM) |
| 40 |
'ais8_1_22.cpp', # Area notice |
| 41 |
'ais8_1_26.cpp', # Environmental Sensor Report |
| 42 |
'ais8_200.cpp', |
| 43 |
'ais8_366.cpp', |
| 44 |
'ais8_367.cpp', |
| 45 |
'ais9.cpp', |
| 46 |
'ais10.cpp', # : |
| 47 |
# 11 See 4 - ; |
| 48 |
'ais12.cpp', # < |
| 49 |
# 13 See 7 - = |
| 50 |
'ais14.cpp', # > |
| 51 |
'ais15.cpp', # ? |
| 52 |
'ais16.cpp', # @ |
| 53 |
'ais17.cpp', # A |
| 54 |
'ais18.cpp', # B |
| 55 |
'ais19.cpp', # C |
| 56 |
'ais20.cpp', # D |
| 57 |
'ais21.cpp', # E |
| 58 |
'ais22.cpp', # F |
| 59 |
'ais23.cpp', # G |
| 60 |
'ais24.cpp', # H |
| 61 |
'ais25.cpp', # I - single slot binary message |
| 62 |
'ais26.cpp', # J - Multi-slot binary message with comm-state |
| 63 |
'ais27.cpp', # K - Long-range position |
| 64 |
# 'ais28.cpp', # L - Not yet defined |
| 65 |
) |
| 66 |
] |
| 67 |
) |
| 68 |
|
| 69 |
tests_require = [ |
| 70 |
'pytest', |
| 71 |
'pytest-cov', |
| 72 |
'pytest-runner', |
| 73 |
] |
| 74 |
|
| 75 |
setup( |
| 76 |
name='libais', |
| 77 |
version=VERSION, |
| 78 |
description='Automatic Identification System decoding - ship tracking', |
| 79 |
long_description=readme, |
| 80 |
author='Kurt Schwehr', |
| 81 |
author_email='[email protected]', |
| 82 |
url='https://github.com/schwehr/libais', |
| 83 |
license='Apache 2.0', |
| 84 |
classifiers=[ |
| 85 |
'License :: OSI Approved :: Apache Software License', |
| 86 |
'Development Status :: 4 - Beta', |
| 87 |
'Intended Audience :: Science/Research', |
| 88 |
'Operating System :: Android', |
| 89 |
'Operating System :: iOS', |
| 90 |
'Operating System :: POSIX', |
| 91 |
'Programming Language :: C++', |
| 92 |
'Programming Language :: Python :: 2.7', |
| 93 |
'Programming Language :: Python :: 3.4', |
| 94 |
'Programming Language :: Python :: Implementation :: CPython', |
| 95 |
'Topic :: Communications', |
| 96 |
'Topic :: Scientific/Engineering :: Information Analysis', |
| 97 |
'Topic :: System :: Networking', |
| 98 |
'Topic :: Scientific/Engineering :: GIS', |
| 99 |
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator', |
| 100 |
], |
| 101 |
|
| 102 |
platforms=["POSIX"], |
| 103 |
scripts=[os.path.join('bin', 'aisdecode')], |
| 104 |
entry_points={ |
| 105 |
'console_scripts': [ |
| 106 |
'libais_stats=ais.stats:main', |
| 107 |
] |
| 108 |
}, |
| 109 |
|
| 110 |
ext_modules=[AIS_MODULE], |
| 111 |
packages=find_packages(exclude=['test']), |
| 112 |
install_requires=['six'], |
| 113 |
extras_require={ |
| 114 |
'tests': tests_require, |
| 115 |
}, |
| 116 |
tests_require=tests_require, |
| 117 |
test_suite="test" |
| 118 |
) |