Skip to content

Commit

Permalink
override target: permits to override target setting the environment v…
Browse files Browse the repository at this point in the history
…ariable `SPACK_TARGET_TYPE`
  • Loading branch information
alalazo committed Feb 10, 2017
1 parent 860b68b commit 842c0a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/spack/spack/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def __init__(self, name):
self.targets = {}
self.operating_sys = {}
self.name = name
self.default = os.environ.get('SPACK_TARGET_TYPE', None)

def add_target(self, name, target):
"""Used by the platform specific subclass to list available targets.
Expand Down Expand Up @@ -335,7 +336,10 @@ def find_compiler(self, cmp_cls, *path):
if newcount <= prevcount:
continue

compilers[ver] = cmp_cls(spec, self, py_platform.machine(), paths)
target = os.environ.get(
'SPACK_TARGET_TYPE', py_platform.machine()
)
compilers[ver] = cmp_cls(spec, self, target, paths)

return list(compilers.values())

Expand Down
5 changes: 4 additions & 1 deletion lib/spack/spack/platforms/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import platform

from spack.architecture import Platform, Target
from spack.operating_systems.linux_distro import LinuxDistro

Expand All @@ -35,7 +36,9 @@ def __init__(self):
self.add_target('x86_64', Target('x86_64'))
self.add_target('ppc64le', Target('ppc64le'))

self.default = platform.machine()
if self.default is None:
self.default = platform.machine()

self.front_end = platform.machine()
self.back_end = platform.machine()

Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/platforms/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class Test(Platform):
priority = 1000000
front_end = 'x86_32'
back_end = 'x86_64'
default = 'x86_64'

front_os = 'redhat6'
back_os = 'debian6'
default_os = 'debian6'

def __init__(self):
super(Test, self).__init__('test')
self.default = 'x86_64'
self.add_target(self.default, Target(self.default))
self.add_target(self.front_end, Target(self.front_end))

Expand Down

0 comments on commit 842c0a4

Please sign in to comment.