summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2017-03-25 23:23:47 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-03-31 13:40:41 -0700
commitb9ee86cac9275076b8e46a7c7c369df8e84e1955 (patch)
tree5e9711915d2f7b77928e73de316ad4143a163a3c
parent7f3f4930249b580bd27891299d330f8dd272ecd3 (diff)
downloadspack-b9ee86cac9275076b8e46a7c7c369df8e84e1955.tar.gz
spack-b9ee86cac9275076b8e46a7c7c369df8e84e1955.tar.bz2
spack-b9ee86cac9275076b8e46a7c7c369df8e84e1955.tar.xz
spack-b9ee86cac9275076b8e46a7c7c369df8e84e1955.zip
Make packages Python3 compatible.
-rw-r--r--var/spack/repos/builtin.mock/packages/multimethod/package.py6
-rw-r--r--var/spack/repos/builtin/packages/hdf5-blosc/package.py24
-rw-r--r--var/spack/repos/builtin/packages/miniconda2/package.py2
-rw-r--r--var/spack/repos/builtin/packages/miniconda3/package.py2
-rw-r--r--var/spack/repos/builtin/packages/ncl/package.py2
-rw-r--r--var/spack/repos/builtin/packages/nwchem/package.py2
6 files changed, 20 insertions, 18 deletions
diff --git a/var/spack/repos/builtin.mock/packages/multimethod/package.py b/var/spack/repos/builtin.mock/packages/multimethod/package.py
index 9e18d65cbb..c0e347bc93 100644
--- a/var/spack/repos/builtin.mock/packages/multimethod/package.py
+++ b/var/spack/repos/builtin.mock/packages/multimethod/package.py
@@ -22,6 +22,8 @@
# 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 six import string_types
+
from spack import *
import spack.architecture
@@ -102,14 +104,14 @@ class Multimethod(MultimethodBase):
# Make sure we can switch methods on different target
#
platform = spack.architecture.platform()
- targets = platform.targets.values()
+ targets = list(platform.targets.values())
if len(targets) > 1:
targets = targets[:-1]
for target in targets:
@when('target=' + target.name)
def different_by_target(self):
- if isinstance(self.spec.architecture.target, basestring):
+ if isinstance(self.spec.architecture.target, string_types):
return self.spec.architecture.target
else:
return self.spec.architecture.target.name
diff --git a/var/spack/repos/builtin/packages/hdf5-blosc/package.py b/var/spack/repos/builtin/packages/hdf5-blosc/package.py
index 4afce02f70..eb63d08dfd 100644
--- a/var/spack/repos/builtin/packages/hdf5-blosc/package.py
+++ b/var/spack/repos/builtin/packages/hdf5-blosc/package.py
@@ -22,7 +22,7 @@
# 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 __future__ import print_function
import os
import shutil
import sys
@@ -115,7 +115,7 @@ class Hdf5Blosc(Package):
def check_install(self, spec):
"Build and run a small program to test the installed HDF5 Blosc plugin"
- print "Checking HDF5-Blosc plugin..."
+ print("Checking HDF5-Blosc plugin...")
checkdir = "spack-check"
with working_dir(checkdir, create=True):
source = r"""\
@@ -188,16 +188,16 @@ Done.
output = ""
success = output == expected
if not success:
- print "Produced output does not match expected output."
- print "Expected output:"
- print "-" * 80
- print expected
- print "-" * 80
- print "Produced output:"
- print "-" * 80
- print output
- print "-" * 80
- print "Environment:"
+ print("Produced output does not match expected output.")
+ print("Expected output:")
+ print("-" * 80)
+ print(expected)
+ print("-" * 80)
+ print("Produced output:")
+ print("-" * 80)
+ print(output)
+ print("-" * 80)
+ print("Environment:")
env = which("env")
env()
raise RuntimeError("HDF5 Blosc plugin check failed")
diff --git a/var/spack/repos/builtin/packages/miniconda2/package.py b/var/spack/repos/builtin/packages/miniconda2/package.py
index 10b85cef32..d23ab080b0 100644
--- a/var/spack/repos/builtin/packages/miniconda2/package.py
+++ b/var/spack/repos/builtin/packages/miniconda2/package.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-from urlparse import urlparse
+from six.moves.urllib.parse import urlparse
from os.path import split
diff --git a/var/spack/repos/builtin/packages/miniconda3/package.py b/var/spack/repos/builtin/packages/miniconda3/package.py
index cd0677b5bc..8184c10d88 100644
--- a/var/spack/repos/builtin/packages/miniconda3/package.py
+++ b/var/spack/repos/builtin/packages/miniconda3/package.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-from urlparse import urlparse
+from six.moves.urllib.parse import urlparse
from os.path import split
diff --git a/var/spack/repos/builtin/packages/ncl/package.py b/var/spack/repos/builtin/packages/ncl/package.py
index 9f834eee3b..b7394cff32 100644
--- a/var/spack/repos/builtin/packages/ncl/package.py
+++ b/var/spack/repos/builtin/packages/ncl/package.py
@@ -229,6 +229,6 @@ class Ncl(Package):
if os.path.exists(filename):
try:
os.remove(filename)
- except OSError, e:
+ except OSError as e:
raise InstallError('Failed to delete file %s: %s' % (
e.filename, e.strerror))
diff --git a/var/spack/repos/builtin/packages/nwchem/package.py b/var/spack/repos/builtin/packages/nwchem/package.py
index f39d8ad0c7..3a8be3f56e 100644
--- a/var/spack/repos/builtin/packages/nwchem/package.py
+++ b/var/spack/repos/builtin/packages/nwchem/package.py
@@ -68,7 +68,7 @@ class Nwchem(Package):
]
}
# Iterate over patches
- for condition, urls in urls_for_patches.iteritems():
+ for condition, urls in urls_for_patches.items():
for url, md5 in urls:
patch(url, when=condition, level=0, md5=md5)