|
9 | 9 | import re
|
10 | 10 | import os
|
11 | 11 | import sys
|
12 |
| -import subprocess |
| 12 | +import subprocess |
13 | 13 |
|
14 | 14 | here = path.abspath(path.dirname(__file__))
|
15 | 15 |
|
16 | 16 |
|
17 |
| -os.environ["CC"] = "g++" |
| 17 | +os.environ["CC"] = "g++" |
18 | 18 | os.environ["CXX"] = "g++"
|
19 | 19 |
|
20 | 20 | # dirty but working
|
|
30 | 30 | with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f:
|
31 | 31 | README = f.read()
|
32 | 32 |
|
33 |
| -opt_arg=["-O3"] |
| 33 | +opt_arg = ["-O3"] |
| 34 | + |
| 35 | +# clean cython output is clean is called |
| 36 | +if 'clean' in sys.argv[1:]: |
| 37 | + if os.path.isfile('ot/lp/emd_wrap.cpp'): |
| 38 | + os.remove('ot/lp/emd_wrap.cpp') |
| 39 | + |
34 | 40 |
|
35 | 41 | # add platform dependant optional compilation argument
|
36 | 42 | if sys.platform.startswith('darwin'):
|
37 |
| - opt_arg.append("-stdlib=libc++") |
38 |
| - sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']) |
39 |
| - os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8")) |
| 43 | + opt_arg.append("-stdlib=libc++") |
| 44 | + sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']) |
| 45 | + os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8")) |
40 | 46 |
|
41 | 47 | setup(name='POT',
|
42 | 48 | version=__version__,
|
43 | 49 | description='Python Optimal Transport Library',
|
44 | 50 | long_description=README,
|
45 |
| - long_description_content_type='text/markdown', |
| 51 | + long_description_content_type='text/markdown', |
46 | 52 | author=u'Remi Flamary, Nicolas Courty',
|
47 | 53 |
|
48 | 54 | url='https://github.com/PythonOT/POT',
|
49 | 55 | packages=find_packages(),
|
50 |
| - ext_modules = cythonize(Extension( |
51 |
| - "ot.lp.emd_wrap", # the extension name |
52 |
| - sources=["ot/lp/emd_wrap.pyx", "ot/lp/EMD_wrapper.cpp"], # the Cython source and |
53 |
| - # additional C++ source files |
54 |
| - language="c++", # generate and compile C++ code, |
55 |
| - include_dirs=[numpy.get_include(),os.path.join(ROOT,'ot/lp')], |
56 |
| - extra_compile_args=opt_arg |
57 |
| - )), |
58 |
| - platforms=['linux','macosx','windows'], |
| 56 | + ext_modules=cythonize(Extension( |
| 57 | + "ot.lp.emd_wrap", # the extension name |
| 58 | + sources=["ot/lp/emd_wrap.pyx", "ot/lp/EMD_wrapper.cpp"], # the Cython source and |
| 59 | + # additional C++ source files |
| 60 | + language="c++", # generate and compile C++ code, |
| 61 | + include_dirs=[numpy.get_include(), os.path.join(ROOT, 'ot/lp')], |
| 62 | + extra_compile_args=opt_arg |
| 63 | + )), |
| 64 | + platforms=['linux', 'macosx', 'windows'], |
59 | 65 | download_url='https://github.com/PythonOT/POT/archive/{}.tar.gz'.format(__version__),
|
60 |
| - license = 'MIT', |
| 66 | + license='MIT', |
61 | 67 | scripts=[],
|
62 | 68 | data_files=[],
|
63 |
| - requires=["numpy","scipy","cython"], |
64 |
| - install_requires=["numpy","scipy","cython"], |
| 69 | + requires=["numpy", "scipy", "cython"], |
| 70 | + install_requires=["numpy", "scipy", "cython"], |
65 | 71 | classifiers=[
|
66 |
| - 'Development Status :: 5 - Production/Stable', |
67 |
| - 'Intended Audience :: Developers', |
68 |
| - 'Intended Audience :: Education', |
69 |
| - 'Intended Audience :: Science/Research', |
70 |
| - 'License :: OSI Approved :: MIT License', |
71 |
| - 'Environment :: Console', |
72 |
| - 'Operating System :: OS Independent', |
73 |
| - 'Operating System :: MacOS', |
74 |
| - 'Operating System :: POSIX', |
75 |
| - 'Programming Language :: Python', |
76 |
| - 'Programming Language :: C++', |
77 |
| - 'Programming Language :: C', |
78 |
| - 'Programming Language :: Cython', |
79 |
| - 'Topic :: Utilities', |
80 |
| - 'Topic :: Scientific/Engineering :: Artificial Intelligence', |
81 |
| - 'Topic :: Scientific/Engineering :: Mathematics', |
82 |
| - 'Topic :: Scientific/Engineering :: Information Analysis', |
83 |
| - 'Programming Language :: Python :: 2', |
84 |
| - 'Programming Language :: Python :: 2.7', |
85 |
| - 'Programming Language :: Python :: 3', |
86 |
| - 'Programming Language :: Python :: 3.4', |
87 |
| - 'Programming Language :: Python :: 3.5', |
88 |
| - 'Programming Language :: Python :: 3.6', |
89 |
| - ] |
90 |
| - ) |
| 72 | + 'Development Status :: 5 - Production/Stable', |
| 73 | + 'Intended Audience :: Developers', |
| 74 | + 'Intended Audience :: Education', |
| 75 | + 'Intended Audience :: Science/Research', |
| 76 | + 'License :: OSI Approved :: MIT License', |
| 77 | + 'Environment :: Console', |
| 78 | + 'Operating System :: OS Independent', |
| 79 | + 'Operating System :: MacOS', |
| 80 | + 'Operating System :: POSIX', |
| 81 | + 'Programming Language :: Python', |
| 82 | + 'Programming Language :: C++', |
| 83 | + 'Programming Language :: C', |
| 84 | + 'Programming Language :: Cython', |
| 85 | + 'Topic :: Utilities', |
| 86 | + 'Topic :: Scientific/Engineering :: Artificial Intelligence', |
| 87 | + 'Topic :: Scientific/Engineering :: Mathematics', |
| 88 | + 'Topic :: Scientific/Engineering :: Information Analysis', |
| 89 | + 'Programming Language :: Python :: 2', |
| 90 | + 'Programming Language :: Python :: 2.7', |
| 91 | + 'Programming Language :: Python :: 3', |
| 92 | + 'Programming Language :: Python :: 3.4', |
| 93 | + 'Programming Language :: Python :: 3.5', |
| 94 | + 'Programming Language :: Python :: 3.6', |
| 95 | + ] |
| 96 | + ) |
0 commit comments