Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override target setting an environment variable #127

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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