forked from Ripser/ripser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pep8 and fixes so pypi markdown renders
- Loading branch information
Nathaniel Saul
committed
Apr 18, 2018
1 parent
657e43d
commit 7a3572b
Showing
1 changed file
with
43 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import sys | ||
from distutils.core import setup, Extension | ||
|
||
from setuptools import setup | ||
from setuptools.extension import Extension | ||
|
||
# we'd better have Cython installed, or it's a no-go | ||
try: | ||
from Cython.Build import cythonize | ||
from Cython.Distutils import build_ext | ||
from Cython.Build import cythonize | ||
from Cython.Distutils import build_ext | ||
except: | ||
print("You don't seem to have Cython installed. Please get a") | ||
print("copy from www.cython.org or install it with `pip install Cython`") | ||
|
@@ -14,52 +16,51 @@ | |
with open('README.md') as f: | ||
long_description = f.read() | ||
|
||
#c++ -std=c++11 ripser.cpp -o ripser -Ofast -D NDEBUG -D PRINT_PERSISTENCE_PAIRS | ||
# c++ -std=c++11 ripser.cpp -o ripser -Ofast -D NDEBUG -D PRINT_PERSISTENCE_PAIRS | ||
#options = ["-std=c++11", "-Ofast"] | ||
options = ["-std=c++11", "-Ofast"] | ||
|
||
if sys.version_info[0] == 2: | ||
options.append("-fpermissive") | ||
options.append("-fpermissive") | ||
|
||
class CustomBuildExtCommand(build_ext): | ||
""" This extension command lets us not require numpy be installed before running pip install ripser """ | ||
"""build_ext command for use when numpy headers are needed.""" | ||
def run(self): | ||
# Import numpy here, only when headers are needed | ||
import numpy | ||
# Add numpy headers to include_dirs | ||
self.include_dirs.append(numpy.get_include()) | ||
# Call original build_ext command | ||
build_ext.run(self) | ||
|
||
setup( | ||
name="ripser", | ||
version='0.1.5', | ||
description="A Lean Persistent Homology Library for Python", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Chris Tralie, Nathaniel Saul", | ||
author_email="[email protected], [email protected]", | ||
url="https://github.com/ctralie/ripser", | ||
license='LGPL', | ||
packages=['ripser'], | ||
class CustomBuildExtCommand(build_ext): | ||
""" This extension command lets us not require numpy be installed before running pip install ripser """ | ||
"""build_ext command for use when numpy headers are needed.""" | ||
|
||
ext_modules = cythonize( | ||
Extension("pyRipser", | ||
sources = ["ripser/pyRipser.pyx"], | ||
define_macros=[("USE_COEFFICIENTS", 1), ("PYTHON_EXTENSION", 1), ("NDEBUG", 1), ("ASSEMBLE_REDUCTION_MATRIX", 1)], | ||
extra_compile_args = options, | ||
language="c++" | ||
)), | ||
def run(self): | ||
# Import numpy here, only when headers are needed | ||
import numpy | ||
# Add numpy headers to include_dirs | ||
self.include_dirs.append(numpy.get_include()) | ||
# Call original build_ext command | ||
build_ext.run(self) | ||
|
||
install_requires=[ | ||
'Cython', | ||
'numpy', | ||
'scipy', | ||
'matplotlib', | ||
'scikit-learn' | ||
], | ||
cmdclass = {'build_ext': CustomBuildExtCommand}, | ||
|
||
setup(name="ripser", | ||
version='0.1.6', | ||
description="A Lean Persistent Homology Library for Python", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Chris Tralie, Nathaniel Saul", | ||
author_email="[email protected], [email protected]", | ||
url="https://github.com/ctralie/ripser", | ||
license='LGPL', | ||
packages=['ripser'], | ||
ext_modules=cythonize(Extension("pyRipser", | ||
sources=["ripser/pyRipser.pyx"], | ||
define_macros=[("USE_COEFFICIENTS", 1), ("PYTHON_EXTENSION", 1), | ||
("NDEBUG", 1), ("ASSEMBLE_REDUCTION_MATRIX", 1)], | ||
extra_compile_args=options, | ||
language="c++" | ||
)), | ||
|
||
) | ||
install_requires=[ | ||
'Cython', | ||
'numpy', | ||
'scipy', | ||
'matplotlib', | ||
'scikit-learn' | ||
], | ||
cmdclass={'build_ext': CustomBuildExtCommand}, | ||
) |