diff options
| author | Florian Fischer <muhq@muhq.space> | 2019-03-19 00:53:01 +0100 |
|---|---|---|
| committer | Florian Fischer <muhq@muhq.space> | 2019-03-19 00:53:01 +0100 |
| commit | e37d42d9f01bece5f3a451cca7ffc435c66e0fb6 (patch) | |
| tree | 2ac5656e5db05a818ed8db52cd460e8a88195c94 | |
| parent | 56be2bcb517d3830e8d43265faf511623845b5e2 (diff) | |
| download | allocbench-e37d42d9f01bece5f3a451cca7ffc435c66e0fb6.tar.gz allocbench-e37d42d9f01bece5f3a451cca7ffc435c66e0fb6.zip | |
collect facts on demand
this fixes a exception because of the missing ccinfo file
when src.facter is imported before the build of allocbench
| -rwxr-xr-x | bench.py | 3 | ||||
| -rw-r--r-- | src/facter.py | 20 |
2 files changed, 13 insertions, 10 deletions
@@ -77,6 +77,9 @@ def main(): subprocess.run(make_cmd) + # collect facts + src.facter.collect_facts() + # Default allocator definition file allocators_file = os.path.join("build", "allocators", "allocators.py") diff --git a/src/facter.py b/src/facter.py index 6f6ba87..e5fa799 100644 --- a/src/facter.py +++ b/src/facter.py @@ -6,17 +6,17 @@ import sys import src.globalvars as gv -# Populate src.globalvars.facts on import -_uname = platform.uname() -gv.facts["hostname"] = _uname.node -gv.facts["system"] = _uname.system -gv.facts["kernel"] = _uname.release -gv.facts["arch"] = _uname.machine -gv.facts["cpus"] = multiprocessing.cpu_count() - -with open(os.path.join(gv.builddir, "ccinfo"), "r") as ccinfo: - gv.facts["cc"] = ccinfo.readlines()[-1][:-1] +def collect_facts(): + # Populate src.globalvars.facts on import + _uname = platform.uname() + gv.facts["hostname"] = _uname.node + gv.facts["system"] = _uname.system + gv.facts["kernel"] = _uname.release + gv.facts["arch"] = _uname.machine + gv.facts["cpus"] = multiprocessing.cpu_count() + with open(os.path.join(gv.builddir, "ccinfo"), "r") as ccinfo: + gv.facts["cc"] = ccinfo.readlines()[-1][:-1] def get_libc_version(bin=None): bin = bin or sys.executable |
