From cdcf5f101523ca2edc497a8de559b2c538ddbd89 Mon Sep 17 00:00:00 2001 From: Bryn Keller Date: Wed, 30 Nov 2016 20:26:34 -0800 Subject: Moved setup.py to root so that we could avoid need for symbolic link. Updated readme.rst and other files to reflect this change, added requirement for enum34 when using python 2.7. Also added explanation that the system python 2.7.10 on Mac OS X is to be avoided. --- setup.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 setup.py (limited to 'setup.py') diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6d082d7 --- /dev/null +++ b/setup.py @@ -0,0 +1,73 @@ +from setuptools import setup, Extension, find_packages +from setuptools.command.build_ext import build_ext +import sys +import os.path +from io import open + +if sys.version_info < (2, 7, 12): + print("Sorry, PHAT requires Python 2.7.12 or later") + sys.exit(1) + + +ext_modules = [ + Extension( + '_phat', + ['python/_phat.cpp'], + include_dirs=['include'], + language='c++', + ), +] + +here = os.path.abspath(os.path.dirname(__file__)) + +# Get the long description from the README file +with open(os.path.join(here, 'python', 'README.rst'), encoding = 'utf8') as f: + long_description = f.read() + +class BuildExt(build_ext): + """A custom build extension for adding compiler-specific options.""" + c_opts = { + 'msvc': ['/EHsc'], + 'unix': ['-std=c++11'], + } + + if sys.platform == 'darwin': + c_opts['unix'] += ['-stdlib=libc++', '-mmacosx-version-min=10.7'] + + def build_extensions(self): + ct = self.compiler.compiler_type + opts = self.c_opts.get(ct, []) + import pybind11 + for ext in self.extensions: + ext.extra_compile_args = opts + ext.include_dirs.append(pybind11.get_include()) + ext.include_dirs.append(pybind11.get_include(user=True)) + build_ext.build_extensions(self) + +requires = ['pybind11'] + +if sys.version_info < (3,4,0): + requires.append('enum34') + +setup( + name='phat', + version='0.0.1', + author='Bryn Keller', + author_email='bryn.keller@intel.com', + url='https://bitbucket.org/phat-code/phat', + description='Python bindings for PHAT', + license = 'LGPL', + keywords='algebraic-topology PHAT distributed topology persistent-homology', + long_description=long_description, + ext_modules=ext_modules, + install_requires=requires, + cmdclass={'build_ext': BuildExt}, + package_dir={'':'python'}, + py_modules = ['phat'], + # packages = find_packages(exclude = ['doc', 'test']) + ) + + + + + -- cgit v1.2.3 From beadd363d0a78cea8718a605ed1364feb790770c Mon Sep 17 00:00:00 2001 From: Bryn Keller Date: Thu, 8 Dec 2016 15:52:34 -0800 Subject: Updated readme.md to mention the Python bindings, set python bindings version number to 1.5.0 to match main project version --- README.md | 4 ++++ setup.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/README.md b/README.md index 9a30ffa..0f83bc9 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,10 @@ Supported Platforms: * Visual Studio 2008 and 2012 (2010 untested) * GCC version 4.4. and higher +## Python Bindings ## +We provide bindings for Python 3.x and 2.7.12+, which are installable using `pip`. Please see +the Python-specific README.rst in the `python` folder of this repository for details. + References: 1. H.Edelsbrunner, J.Harer: Computational Topology, An Introduction. American Mathematical Society, 2010, ISBN 0-8218-4925-5 diff --git a/setup.py b/setup.py index 6d082d7..1ce0e51 100644 --- a/setup.py +++ b/setup.py @@ -51,11 +51,11 @@ if sys.version_info < (3,4,0): setup( name='phat', - version='0.0.1', + version='1.5.0', author='Bryn Keller', author_email='bryn.keller@intel.com', url='https://bitbucket.org/phat-code/phat', - description='Python bindings for PHAT', + description='Python bindings for PHAT, the C++ based Persistent Homology Algorithm Toolbox', license = 'LGPL', keywords='algebraic-topology PHAT distributed topology persistent-homology', long_description=long_description, -- cgit v1.2.3