-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
86 lines (68 loc) · 3.08 KB
/
setup.py
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
"""
temperature_cpp
Example of binding C++/Python via setuptools
"""
import sys
import os
import platform
from setuptools import setup, find_packages, Extension
import versioneer
short_description = __doc__.split("\n")
# from https://github.com/pytest-dev/pytest-runner#conditional-requirement
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
try:
with open("README.md", "r") as handle:
long_description = handle.read()
except:
long_description = "\n".join(short_description[2:]),
#################################################################
# Build our C++ module
# NOTE: Pybind11/Eigen were installed into CONDA_PREFIX
# so we need to add that to the include paths
conda_prefix = os.environ['CONDA_PREFIX']
eigen_path = os.path.join(conda_prefix, 'include', 'eigen3')
# MacOSX causes some problems. This is due to a recent
# deprecation of the stdc++ library
if sys.platform == 'darwin':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = platform.mac_ver()[0]
cpp_module = Extension('temperature.temperature_cpp',
include_dirs = [eigen_path],
extra_compile_args = ['-std=c++11'],
sources = ['temperature_cpp/temperature.cpp',
'temperature_cpp/export.cpp'])
#################################################################
setup(
# Self-descriptive entries which should always be present
name='temperature_cpp',
author='Benjamin Pritchard',
author_email='[email protected]',
description=short_description[0],
long_description=long_description,
long_description_content_type="text/markdown",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license='BSD-3-Clause',
# Which Python importable modules should be included when your package is installed
# Handled automatically by setuptools. Use 'exclude' to prevent some specific
# subpackage(s) from being added, if needed
packages=find_packages(),
# Optional include package data to ship with your package
# Customize MANIFEST.in if the general case does not suit your needs
# Comment out this line to prevent the files from being packaged with your software
include_package_data=True,
# Allows `setup.py test` to work correctly with pytest
setup_requires=[] + pytest_runner,
# Include the compiled extension
ext_modules = [cpp_module]
# Additional entries you may want simply uncomment the lines you want and fill in the data
# url='http://www.my_package.com', # Website
# install_requires=[], # Required packages, pulls from pip if needed; do not use for Conda deployment
# platforms=['Linux',
# 'Mac OS-X',
# 'Unix',
# 'Windows'], # Valid platforms your code works on, adjust to your flavor
# python_requires=">=3.5", # Python version restrictions
# Manual control if final package is compressible or not, set False to prevent the .egg from being made
# zip_safe=False,
)