summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGregory Lee <lee218@llnl.gov>2017-04-26 11:53:27 -0700
committerAdam J. Stewart <ajstewart426@gmail.com>2017-04-26 13:53:27 -0500
commit378935916a2d49c9afabc5424028894a1b7e3e76 (patch)
treea5439bb1844ced73a242424d73f8fce238fbf2cf /var
parent1e18ace6472c94893cc567ca757032269e02460f (diff)
downloadspack-378935916a2d49c9afabc5424028894a1b7e3e76.tar.gz
spack-378935916a2d49c9afabc5424028894a1b7e3e76.tar.bz2
spack-378935916a2d49c9afabc5424028894a1b7e3e76.tar.xz
spack-378935916a2d49c9afabc5424028894a1b7e3e76.zip
matplotlib and basemap require setuptools to run properly together (#3835)
* matplotlib and basemap require setuptools to run properly together * flake 8 fix
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-basemap/package.py81
-rw-r--r--var/spack/repos/builtin/packages/py-matplotlib/package.py5
2 files changed, 8 insertions, 78 deletions
diff --git a/var/spack/repos/builtin/packages/py-basemap/package.py b/var/spack/repos/builtin/packages/py-basemap/package.py
index e0687f1d52..723adacff8 100644
--- a/var/spack/repos/builtin/packages/py-basemap/package.py
+++ b/var/spack/repos/builtin/packages/py-basemap/package.py
@@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import os
class PyBasemap(PythonPackage):
@@ -35,6 +34,10 @@ class PyBasemap(PythonPackage):
version('1.0.7', '48c0557ced9e2c6e440b28b3caff2de8')
+ # Per Github issue #3813, setuptools is required at runtime in order
+ # to make mpl_toolkits a namespace package that can span multiple
+ # directories (i.e., matplotlib and basemap)
+ depends_on('py-setuptools', type=('build', 'run'))
depends_on('py-numpy', type=('build', 'run'))
depends_on('py-matplotlib', type=('build', 'run'))
depends_on('pil', type=('build', 'run'))
@@ -42,79 +45,3 @@ class PyBasemap(PythonPackage):
def setup_environment(self, spack_env, run_env):
spack_env.set('GEOS_DIR', self.spec['geos'].prefix)
-
- @run_after('install')
- def post_install_patch(self):
- spec = self.spec
- # We are not sure if this fix is needed before Python 3.5.2.
- # If it is needed, this test should be changed.
- # See: https://github.com/LLNL/spack/pull/1964
- if spec['python'].version >= Version('3.5.2'):
- # Use symlinks to join the two mpl_toolkits/ directories into
- # one, inside of basemap. This is because Basemap tries to
- # "add to" an existing package in Matplotlib, which is only
- # legal Python for "Implicit Namespace Packages":
- # https://www.python.org/dev/peps/pep-0420/
- # https://github.com/Homebrew/homebrew-python/issues/112
- # In practice, Python will see only the basemap version of
- # mpl_toolkits
- path_m = find_package_dir(
- spec['py-matplotlib'].prefix, 'mpl_toolkits')
- path_b = find_package_dir(spec.prefix, 'mpl_toolkits')
- link_dir(path_m, path_b)
-
-
-def find_package_dir(spack_package_root, name):
-
- """Finds directory with a specific name, somewhere inside a Spack
- package.
-
- spack_package_root:
- Root directory to start searching
- oldname:
- Original name of package (not fully qualified, just the leaf)
- newname:
- What to rename it to
-
- """
- for root, dirs, files in os.walk(spack_package_root):
- path = os.path.join(root, name)
-
- # Make sure it's a directory
- if not os.path.isdir(path):
- continue
-
- # Make sure it's really a package
- if not os.path.exists(os.path.join(path, '__init__.py')):
- continue
-
- return path
-
- return None
-
-
-def link_dir(src_root, dest_root, link=os.symlink):
- """Link all files in src_root into directory dest_root"""
-
- for src_path, dirnames, filenames in os.walk(src_root):
- if not filenames:
- continue # avoid explicitly making empty dirs
-
- # Avoid internal Python stuff
- src_leaf = os.path.split(src_path)[1]
- if src_leaf.startswith('__'):
- continue
-
- # Make sure the destination directory exists
- dest_path = os.path.join(dest_root, src_path[len(src_root) + 1:])
- try:
- os.makedirs(dest_path)
- except:
- pass
-
- # Link all files from src to dest directory
- for fname in filenames:
- src = os.path.join(src_path, fname)
- dst = os.path.join(dest_path, fname)
- if not os.path.exists(dst):
- link(src, dst)
diff --git a/var/spack/repos/builtin/packages/py-matplotlib/package.py b/var/spack/repos/builtin/packages/py-matplotlib/package.py
index 7177ea5a79..34ebeaf5ff 100644
--- a/var/spack/repos/builtin/packages/py-matplotlib/package.py
+++ b/var/spack/repos/builtin/packages/py-matplotlib/package.py
@@ -59,7 +59,10 @@ class PyMatplotlib(PythonPackage):
extends('python', ignore=r'bin/nosetests.*$|bin/pbr$')
# ------ Required dependencies
- depends_on('py-setuptools', type='build')
+ # Per Github issue #3813, setuptools is required at runtime in order
+ # to make mpl_toolkits a namespace package that can span multiple
+ # directories (i.e., matplotlib and basemap)
+ depends_on('py-setuptools', type=('build', 'run'))
depends_on('libpng@1.2:')
depends_on('freetype@2.3:')