From 16a7b27a9eac19384db919e3d2567d3ee8e14ea4 Mon Sep 17 00:00:00 2001
From: Matthew Krafczyk <krafczyk.matthew@gmail.com>
Date: Fri, 21 Apr 2017 15:56:21 -0700
Subject: [PATCH] more fixes for use of setuptools in python packages

- py-setuptools is required by py-yt for importing yt in jupyter notebooks.
- add two dependencies needed for python 2.7
- add the py-subprocess32 package
---
 .../builtin/packages/py-matplotlib/package.py |  2 ++
 .../packages/py-subprocess32/package.py       | 34 +++++++++++++++++++
 .../repos/builtin/packages/py-yt/package.py   |  2 +-
 3 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 var/spack/repos/builtin/packages/py-subprocess32/package.py

diff --git a/var/spack/repos/builtin/packages/py-matplotlib/package.py b/var/spack/repos/builtin/packages/py-matplotlib/package.py
index 53a7d9af97..7177ea5a79 100644
--- a/var/spack/repos/builtin/packages/py-matplotlib/package.py
+++ b/var/spack/repos/builtin/packages/py-matplotlib/package.py
@@ -69,6 +69,8 @@ class PyMatplotlib(PythonPackage):
     depends_on('py-pyparsing', type=('build', 'run'))
     depends_on('py-pytz', type=('build', 'run'))
     depends_on('py-cycler@0.9:', type=('build', 'run'))
+    depends_on('py-subprocess32', type=('build', 'run'), when='^python@:2.7')
+    depends_on('py-functools32', type=('build', 'run'), when='^python@2.7')
 
     # ------ Optional GUI frameworks
     depends_on('tk@8.3:', when='+tk')  # not 8.6.0 or 8.6.1
diff --git a/var/spack/repos/builtin/packages/py-subprocess32/package.py b/var/spack/repos/builtin/packages/py-subprocess32/package.py
new file mode 100644
index 0000000000..35d11e1bee
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-subprocess32/package.py
@@ -0,0 +1,34 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+from spack import *
+
+
+class PySubprocess32(PythonPackage):
+    """A backport of the subprocess module from Python 3.2/3.3 for 2.x."""
+
+    homepage = "https://pypi.python.org/pypi/subprocess32"
+    url      = "https://pypi.io/packages/source/s/subprocess32/subprocess32-3.2.7.tar.gz"
+
+    version('3.2.7', '824c801e479d3e916879aae3e9c15e16')
diff --git a/var/spack/repos/builtin/packages/py-yt/package.py b/var/spack/repos/builtin/packages/py-yt/package.py
index cefef2e1d3..d76c9bebb1 100644
--- a/var/spack/repos/builtin/packages/py-yt/package.py
+++ b/var/spack/repos/builtin/packages/py-yt/package.py
@@ -66,7 +66,7 @@ class PyYt(PythonPackage):
     depends_on("py-matplotlib", type=('build', 'run'))
     depends_on("py-numpy", type=('build', 'run'))
     depends_on("py-scipy", type=('build', 'run'), when="+scipy")
-    depends_on("py-setuptools", type="build")
+    depends_on("py-setuptools", type=('build', 'run'))
     depends_on("py-sympy", type=('build', 'run'))
     depends_on("rockstar@yt", type=('build', 'run'), when="+rockstar")
     depends_on("python @2.7:2.999,3.4:")
-- 
GitLab