From 8933a84a14bfda3da66983ea35784ad90091f439 Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Mon, 20 Apr 2020 15:53:40 +0200 Subject: pep8 setup.py and remove cython cpp files --- setup.py | 94 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 50 insertions(+), 44 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index e780187..4640d00 100755 --- a/setup.py +++ b/setup.py @@ -9,12 +9,12 @@ import numpy import re import os import sys -import subprocess +import subprocess here = path.abspath(path.dirname(__file__)) -os.environ["CC"] = "g++" +os.environ["CC"] = "g++" os.environ["CXX"] = "g++" # dirty but working @@ -30,61 +30,67 @@ ROOT = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f: README = f.read() -opt_arg=["-O3"] +opt_arg = ["-O3"] + +# clean cython output is clean is called +if 'clean' in sys.argv[1:]: + if os.path.isfile('ot/lp/emd_wrap.cpp'): + os.remove('ot/lp/emd_wrap.cpp') + # add platform dependant optional compilation argument if sys.platform.startswith('darwin'): - opt_arg.append("-stdlib=libc++") - sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']) - os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8")) + opt_arg.append("-stdlib=libc++") + sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']) + os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8")) setup(name='POT', version=__version__, description='Python Optimal Transport Library', long_description=README, - long_description_content_type='text/markdown', + long_description_content_type='text/markdown', author=u'Remi Flamary, Nicolas Courty', author_email='remi.flamary@gmail.com, ncourty@gmail.com', url='https://github.com/PythonOT/POT', packages=find_packages(), - ext_modules = cythonize(Extension( - "ot.lp.emd_wrap", # the extension name - sources=["ot/lp/emd_wrap.pyx", "ot/lp/EMD_wrapper.cpp"], # the Cython source and - # additional C++ source files - language="c++", # generate and compile C++ code, - include_dirs=[numpy.get_include(),os.path.join(ROOT,'ot/lp')], - extra_compile_args=opt_arg - )), - platforms=['linux','macosx','windows'], + ext_modules=cythonize(Extension( + "ot.lp.emd_wrap", # the extension name + sources=["ot/lp/emd_wrap.pyx", "ot/lp/EMD_wrapper.cpp"], # the Cython source and + # additional C++ source files + language="c++", # generate and compile C++ code, + include_dirs=[numpy.get_include(), os.path.join(ROOT, 'ot/lp')], + extra_compile_args=opt_arg + )), + platforms=['linux', 'macosx', 'windows'], download_url='https://github.com/PythonOT/POT/archive/{}.tar.gz'.format(__version__), - license = 'MIT', + license='MIT', scripts=[], data_files=[], - requires=["numpy","scipy","cython"], - install_requires=["numpy","scipy","cython"], + requires=["numpy", "scipy", "cython"], + install_requires=["numpy", "scipy", "cython"], classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Education', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Environment :: Console', - 'Operating System :: OS Independent', - 'Operating System :: MacOS', - 'Operating System :: POSIX', - 'Programming Language :: Python', - 'Programming Language :: C++', - 'Programming Language :: C', - 'Programming Language :: Cython', - 'Topic :: Utilities', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'Topic :: Scientific/Engineering :: Mathematics', - 'Topic :: Scientific/Engineering :: Information Analysis', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - ] - ) + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Education', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: MIT License', + 'Environment :: Console', + 'Operating System :: OS Independent', + 'Operating System :: MacOS', + 'Operating System :: POSIX', + 'Programming Language :: Python', + 'Programming Language :: C++', + 'Programming Language :: C', + 'Programming Language :: Cython', + 'Topic :: Utilities', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + 'Topic :: Scientific/Engineering :: Mathematics', + 'Topic :: Scientific/Engineering :: Information Analysis', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ] + ) -- cgit v1.2.3