Make packages Python3 compatible.
This commit is contained in:
parent
7f3f493024
commit
b9ee86cac9
@ -22,6 +22,8 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
import spack.architecture
|
import spack.architecture
|
||||||
|
|
||||||
@ -102,14 +104,14 @@ def has_a_default(self):
|
|||||||
# Make sure we can switch methods on different target
|
# Make sure we can switch methods on different target
|
||||||
#
|
#
|
||||||
platform = spack.architecture.platform()
|
platform = spack.architecture.platform()
|
||||||
targets = platform.targets.values()
|
targets = list(platform.targets.values())
|
||||||
if len(targets) > 1:
|
if len(targets) > 1:
|
||||||
targets = targets[:-1]
|
targets = targets[:-1]
|
||||||
|
|
||||||
for target in targets:
|
for target in targets:
|
||||||
@when('target=' + target.name)
|
@when('target=' + target.name)
|
||||||
def different_by_target(self):
|
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
|
return self.spec.architecture.target
|
||||||
else:
|
else:
|
||||||
return self.spec.architecture.target.name
|
return self.spec.architecture.target.name
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@ -115,7 +115,7 @@ def install(self, spec, prefix):
|
|||||||
|
|
||||||
def check_install(self, spec):
|
def check_install(self, spec):
|
||||||
"Build and run a small program to test the installed HDF5 Blosc plugin"
|
"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"
|
checkdir = "spack-check"
|
||||||
with working_dir(checkdir, create=True):
|
with working_dir(checkdir, create=True):
|
||||||
source = r"""\
|
source = r"""\
|
||||||
@ -188,16 +188,16 @@ def check_install(self, spec):
|
|||||||
output = ""
|
output = ""
|
||||||
success = output == expected
|
success = output == expected
|
||||||
if not success:
|
if not success:
|
||||||
print "Produced output does not match expected output."
|
print("Produced output does not match expected output.")
|
||||||
print "Expected output:"
|
print("Expected output:")
|
||||||
print "-" * 80
|
print("-" * 80)
|
||||||
print expected
|
print(expected)
|
||||||
print "-" * 80
|
print("-" * 80)
|
||||||
print "Produced output:"
|
print("Produced output:")
|
||||||
print "-" * 80
|
print("-" * 80)
|
||||||
print output
|
print(output)
|
||||||
print "-" * 80
|
print("-" * 80)
|
||||||
print "Environment:"
|
print("Environment:")
|
||||||
env = which("env")
|
env = which("env")
|
||||||
env()
|
env()
|
||||||
raise RuntimeError("HDF5 Blosc plugin check failed")
|
raise RuntimeError("HDF5 Blosc plugin check failed")
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
from urlparse import urlparse
|
from six.moves.urllib.parse import urlparse
|
||||||
from os.path import split
|
from os.path import split
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
from urlparse import urlparse
|
from six.moves.urllib.parse import urlparse
|
||||||
from os.path import split
|
from os.path import split
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,6 +229,6 @@ def delete_files(*filenames):
|
|||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
try:
|
try:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
except OSError, e:
|
except OSError as e:
|
||||||
raise InstallError('Failed to delete file %s: %s' % (
|
raise InstallError('Failed to delete file %s: %s' % (
|
||||||
e.filename, e.strerror))
|
e.filename, e.strerror))
|
||||||
|
@ -68,7 +68,7 @@ class Nwchem(Package):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
# Iterate over patches
|
# Iterate over patches
|
||||||
for condition, urls in urls_for_patches.iteritems():
|
for condition, urls in urls_for_patches.items():
|
||||||
for url, md5 in urls:
|
for url, md5 in urls:
|
||||||
patch(url, when=condition, level=0, md5=md5)
|
patch(url, when=condition, level=0, md5=md5)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user