Skip to content

Commit 8933a84

Browse files
committed
pep8 setup.py and remove cython cpp files
1 parent 8df1b72 commit 8933a84

File tree

1 file changed

+50
-44
lines changed

1 file changed

+50
-44
lines changed

setup.py

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import re
1010
import os
1111
import sys
12-
import subprocess
12+
import subprocess
1313

1414
here = path.abspath(path.dirname(__file__))
1515

1616

17-
os.environ["CC"] = "g++"
17+
os.environ["CC"] = "g++"
1818
os.environ["CXX"] = "g++"
1919

2020
# dirty but working
@@ -30,61 +30,67 @@
3030
with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f:
3131
README = f.read()
3232

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+
3440

3541
# add platform dependant optional compilation argument
3642
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"))
4046

4147
setup(name='POT',
4248
version=__version__,
4349
description='Python Optimal Transport Library',
4450
long_description=README,
45-
long_description_content_type='text/markdown',
51+
long_description_content_type='text/markdown',
4652
author=u'Remi Flamary, Nicolas Courty',
4753
4854
url='https://github.com/PythonOT/POT',
4955
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'],
5965
download_url='https://github.com/PythonOT/POT/archive/{}.tar.gz'.format(__version__),
60-
license = 'MIT',
66+
license='MIT',
6167
scripts=[],
6268
data_files=[],
63-
requires=["numpy","scipy","cython"],
64-
install_requires=["numpy","scipy","cython"],
69+
requires=["numpy", "scipy", "cython"],
70+
install_requires=["numpy", "scipy", "cython"],
6571
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

Comments
 (0)