From fc96c49b0b00e64c4594b69298d6546b55d11e08 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 14 Sep 2021 15:55:02 +0200 Subject: Add py-pot with patch (#25712) --- var/spack/repos/builtin/packages/py-pot/175.patch | 59 ++++++++++++++++++++++ var/spack/repos/builtin/packages/py-pot/package.py | 29 +++++++++++ 2 files changed, 88 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-pot/175.patch create mode 100644 var/spack/repos/builtin/packages/py-pot/package.py diff --git a/var/spack/repos/builtin/packages/py-pot/175.patch b/var/spack/repos/builtin/packages/py-pot/175.patch new file mode 100644 index 0000000000..1bc1c17ac2 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pot/175.patch @@ -0,0 +1,59 @@ +From a91d88847531e3d9b889881770db9dcbb4b41389 Mon Sep 17 00:00:00 2001 +From: "D.J. Sutherland" +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?= +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")) diff --git a/var/spack/repos/builtin/packages/py-pot/package.py b/var/spack/repos/builtin/packages/py-pot/package.py new file mode 100644 index 0000000000..a5cdf51da2 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pot/package.py @@ -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')) -- cgit v1.2.3-70-g09d2