Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
105 lines (87 loc) · 3.07 KB
/
Copy pathsetup.py
File metadata and controls
105 lines (87 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python3
from setuptools import setup, Extension
from distutils.command import build as build_module
import os
import platform
import sys
import unittest
MAJOR_VERSION = 2
MINOR_VERSION = 16
def _run_tests():
directory = os.path.abspath(os.path.dirname(sys.modules['__main__'].__file__))
loader = unittest.defaultTestLoader
runner = unittest.TextTestRunner()
suite = loader.discover(os.path.join(directory, 'test'))
runner.run(suite)
try:
from setuptools.command.test import test
class UnitTests(test):
def finalize_options(self):
test.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
_run_tests()
except ImportError:
from distutils.core import Command
class UnitTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
_run_tests()
class build(build_module.build):
def run(self):
import extract_icsneo40_defines # there should be a better way to do this...
build_module.build.run(self)
home_path = os.path.expanduser('~')
# Grab all the source files
source_files = []
for root, dirs, files in os.walk('src'):
for file in files:
if file.endswith('.cpp') or file.endswith('.c'):
source_files.append(os.path.join(root, file))
# Set compiler flags here
if 'LINUX' in platform.system().upper():
compile_args = [
'-fpermissive',
'-Wno-unused-variable',
'-Wno-unused-function',
'-Wno-write-strings'
]
else:
compile_args = []
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
module = Extension('ics',
define_macros = [('MAJOR_VERSION', MAJOR_VERSION), ('MINOR_VERSION', MINOR_VERSION)],
include_dirs=['include', 'include/ics', 'include/ice'],
libraries = [],
library_dirs = ['/usr/local/lib'],
sources = source_files,
extra_compile_args=compile_args)
setup (name = 'python_ics',
version = '%d.%d' % (MAJOR_VERSION, MINOR_VERSION),
description = 'Library for interfacing with Intrepid devices in Python',
long_description = read('README.md'),
license = "MIT",
author = 'David Rebbe',
author_email='drebbe@intrepidcs.com',
maintainer = 'David Rebbe',
maintainer_email='drebbe@intrepidcs.com',
url='https://github.com/intrepidcs/python_ics/',
cmdclass = { 'build': build, 'test': UnitTests, },
download_url = 'https://github.com/intrepidcs/python_ics/releases',
ext_modules = [module],
classifiers = [
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],)