From 7d3350d0bbcb7468fecfd9abffb3fe9f34c0c6c3 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 25 Apr 2017 00:31:44 +1000 Subject: rtemstoolkit: Move host support access into a separate module. Moving the host support into a module lets it get used where options is not being used. --- rtemstoolkit/solaris.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'rtemstoolkit/solaris.py') diff --git a/rtemstoolkit/solaris.py b/rtemstoolkit/solaris.py index 397df68..dc3e490 100644 --- a/rtemstoolkit/solaris.py +++ b/rtemstoolkit/solaris.py @@ -1,6 +1,6 @@ # # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2010-2016 Chris Johns (chrisj@rtems.org) +# Copyright 2010-2017 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. @@ -22,7 +22,6 @@ # RTEMS project's spec files. # -import pprint import os try: @@ -34,15 +33,19 @@ except (ValueError, SystemError): import error import execute -def load(): - uname = os.uname() +def cpus(): psrinfo = '/sbin/psrinfo|wc -l' e = execute.capture_execution() exit_code, proc, output = e.shell(psrinfo) if exit_code == 0: - ncpus = output + ncpus = int(output) else: - ncpus = '1' + ncpus = 1 + return ncpus + +def overrides(): + uname = os.uname() + ncpus = '%d' % (cpus()) if uname[4] == 'i86pc': cpu = 'i386' else: @@ -87,4 +90,6 @@ def load(): return defines if __name__ == '__main__': - pprint.pprint(load()) + import pprint + pprint.pprint(cpus()) + pprint.pprint(overrides()) -- cgit v1.2.3