Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for py-cython with python 3.10+ (installs in subdir local) #186

23 changes: 23 additions & 0 deletions var/spack/repos/builtin/packages/py-cython/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os

from spack.package import *


Expand Down Expand Up @@ -46,6 +48,23 @@ class PyCython(PythonPackage):
depends_on("py-setuptools", type=("build", "run"))
depends_on("[email protected]:", type="test")

@property
def prefix(self):
prefix = super(PyCython, self).prefix
if os.path.isdir(os.path.join(prefix, "local", "bin")) and not os.path.isdir(
os.path.join(prefix, "bin")
):
prefix.bin = os.path.join(prefix, "local", "bin")
if os.path.isdir(os.path.join(prefix, "local", "lib")) and not os.path.isdir(
os.path.join(prefix, "lib")
):
prefix.lib = os.path.join(prefix, "local", "lib")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't help if you're on an OS that uses lib64 instead of lib.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, added an additional elif clause to cover this. Don't like any of these solutions, but the solutions you mentioned above aren't available in the authoritative spack repo yet.

Copy link

@adamjstewart adamjstewart Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you'll also need to do what you're doing here for every Python package in Spack...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know ... my strategy is to have this fixed temporarily (because it's the only package in our fairly comprehensive software stack that has this problem) and then get the clean solution from spack once that is available.

elif os.path.isdir(os.path.join(prefix, "local", "lib64")) and not os.path.isdir(
os.path.join(prefix, "lib64")
):
prefix.lib = os.path.join(prefix, "local", "lib64")
return prefix

@property
def command(self):
"""Returns the Cython command"""
Expand All @@ -56,3 +75,7 @@ def command(self):
def build_test(self):
# Warning: full suite of unit tests takes a very long time
python("runtests.py", "-j", str(make_jobs))

def setup_dependent_build_environment(self, env, dependent_spec):
env.prepend_path("PATH", self.prefix.bin)
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
3 changes: 2 additions & 1 deletion var/spack/repos/builtin/packages/py-shapely/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class PyShapely(PythonPackage):
# the hacky logic in [email protected] looks for libgeos_c.so in the miniconda
# install tree ... need to comment that out so that spack's libgeos_c.so is found.
# Also need to add logic to find libgeos_c.so from spack geos modules, if loaded.
patch("shapely-1.8.0-geos.py.patch", when="@1.8.0:1.8.3")
# This patch only works for 1.8.0/1.8.1, but may also be needed for 1.8.2-1.8.5
patch("shapely-1.8.0-geos.py.patch", when="@1.8.0:1.8.1")

@when("^[email protected]:")
def patch(self):
Expand Down