diff options
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. |