Add py-pot with patch (#25712)

This commit is contained in:
Harmen Stoppels 2021-09-14 15:55:02 +02:00 committed by GitHub
parent ce790a89f2
commit fc96c49b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,59 @@
From a91d88847531e3d9b889881770db9dcbb4b41389 Mon Sep 17 00:00:00 2001
From: "D.J. Sutherland" <djs@djsutherland.ml>
Date: Wed, 13 May 2020 14:21:54 -0500
Subject: [PATCH 1/2] only mangle CC/etc if on mac and not told not to
---
setup.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/setup.py b/setup.py
index 91c24d91..58c7da57 100755
--- a/setup.py
+++ b/setup.py
@@ -14,9 +14,6 @@
here = path.abspath(path.dirname(__file__))
-os.environ["CC"] = "g++"
-os.environ["CXX"] = "g++"
-
# dirty but working
__version__ = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too
@@ -39,7 +36,9 @@
# add platform dependant optional compilation argument
-if sys.platform.startswith('darwin'):
+if sys.platform.startswith('darwin') and not os.environ.get('POT_LEAVE_CC', ''):
+ os.environ["CC"] = "g++"
+ os.environ["CXX"] = "g++"
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"))
From 8d9ad11abdd1a3d5d42c57592b2700e3592f7d77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Flamary?= <remi.flamary@gmail.com>
Date: Fri, 15 May 2020 08:36:58 +0200
Subject: [PATCH 2/2] remove CC for macosx (test)
---
setup.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index f5c82993..40d50dff 100755
--- a/setup.py
+++ b/setup.py
@@ -36,9 +36,7 @@
# add platform dependant optional compilation argument
-if sys.platform.startswith('darwin') and not os.environ.get('POT_LEAVE_CC', ''):
- os.environ["CC"] = "g++"
- os.environ["CXX"] = "g++"
+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"))

View File

@ -0,0 +1,29 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPot(PythonPackage):
"""
This open source Python library provide several solvers for optimization
problems related to Optimal Transport for signal, image processing and
machine learning.
"""
homepage = "https://github.com/PythonOT/POT"
pypi = "POT/POT-0.7.0.tar.gz"
version('0.7.0', sha256='d4ac2bc8791f049a3166820d51e218d6c299885449b735eafef8d18c76d4ad06')
# Avoid that CC and CXX are overridden with g++ in setup.py.
patch('175.patch', when='@0.7.0')
depends_on('python@2.7:2.7.999,3.4:', type=('build', 'run'))
depends_on('py-setuptools', type='build')
depends_on('py-numpy@1.16:', type=('build', 'run'))
depends_on('py-scipy@1.0:', type=('build', 'run'))
depends_on('py-cython@0.23:', type=('build', 'run'))