diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-25 11:45:30 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-13 15:20:02 +0000 |
commit | 92d98f57eaa6e0871b70d0d0ab1db879cf3ea47a (patch) | |
tree | e8d6629110f8c079c2d94b6f1e3fe8e239b9fd43 /morphlib/util.py | |
parent | ece7f823de6bd61a0676edf71a9525697848824e (diff) | |
download | morph-92d98f57eaa6e0871b70d0d0ab1db879cf3ea47a.tar.gz |
Set environment variables defining target for build-essential
In the future we will allow this to be modified to provide a
cross-bootstrap mode, but for now we use the same target as
the host compiler.
Diffstat (limited to 'morphlib/util.py')
-rw-r--r-- | morphlib/util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/morphlib/util.py b/morphlib/util.py index 16063f45..c3a7ac9f 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -42,6 +42,17 @@ def arch(): '''Return the CPU architecture of the current host.''' return os.uname()[4] + +def target(runcmd): # pragma: no cover + '''Returns the machine triplet of the current host''' + try: + target = runcmd(['cc', '-dumpmachine']).strip() + except cliapp.AppException as e: + raise morphlib.Error( + 'Failed to execute host compiler \'cc\': %s' % e) + return target + + def indent(string, spaces=4): '''Return ``string`` indented by ``spaces`` spaces. |