aboutsummaryrefslogtreecommitdiff
path: root/src/facter.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-12-11 13:30:53 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-12-11 21:42:43 +0100
commit372a5366458c88a3571b4b7a19db538bbf947c3d (patch)
treee2f46c356ad468aa776dbe61c6d1b35f4d0eca5d /src/facter.py
parent34380322156c74a664e63e426b8994cf16332ff5 (diff)
downloadallocbench-372a5366458c88a3571b4b7a19db538bbf947c3d.tar.gz
allocbench-372a5366458c88a3571b4b7a19db538bbf947c3d.zip
format the __init__ files, facter and util using yapf
Diffstat (limited to 'src/facter.py')
-rw-r--r--src/facter.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/facter.py b/src/facter.py
index c3c95cd..fe0b316 100644
--- a/src/facter.py
+++ b/src/facter.py
@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with allocbench. If not, see <http://www.gnu.org/licenses/>.
-
"""Collect facts about the benchmark environment"""
import ctypes
@@ -53,6 +52,7 @@ def collect_facts():
starttime = starttime[:starttime.rfind(':')]
gv.facts["starttime"] = starttime
+
def store_facts(path=None):
"""Store facts to file"""
if not path:
@@ -66,6 +66,7 @@ def store_facts(path=None):
with open(filename, "w") as f:
json.dump(gv.facts, f)
+
def load_facts(path=None):
"""Load facts from file"""
if not path:
@@ -86,10 +87,12 @@ def load_facts(path=None):
with open(filename, "rb") as f:
gv.facts = pickle.load(f)
else:
- raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), filename)
+ raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
+ filename)
print_info(f"Loading facts from: {filename}")
+
# Copied from pip.
# https://github.com/pypa/pip/blob/master/src/pip/_internal/utils/glibc.py
# Licensed under MIT.
@@ -148,10 +151,12 @@ def libc_ver(executable=None):
return ("glibc", glibc_version)
+
def exe_version(executable, version_flag="--version"):
"""Return version of executable"""
proc = subprocess.run([executable, version_flag],
- universal_newlines=True, stdout=subprocess.PIPE)
+ universal_newlines=True,
+ stdout=subprocess.PIPE)
if proc.returncode != 0:
print_warning(f"failed to get version of {executable}")