]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Reset functionality exported from main_loop
authorKarel Kočí <cynerd@email.cz>
Mon, 23 Mar 2015 09:34:38 +0000 (10:34 +0100)
committerKarel Kočí <cynerd@email.cz>
Mon, 23 Mar 2015 09:34:38 +0000 (10:34 +0100)
But not working yet

scripts/main_loop.py
scripts/reset.py [new file with mode: 0755]

index e9eb4baa627b239405059a5e05a4072350cff90b..cacf349f6621be996fbb6c4a2dc047c9237a0017 100755 (executable)
@@ -68,22 +68,6 @@ def step():
                print("-- Linux built")
                phase.set(2)
 
-def rm_rf(d):
-       for path in (os.path.join(d,f) for f in os.listdir(d)):
-               if os.path.isdir(path):
-                       rm_rf(path)
-               else:
-                       os.unlink(path)
-               os.rmdir(d)
-
-# TODO repair, broken
-def reset():
-       rm_rf(conf.build_folder)
-       os.chdir(conf.linux_sources)
-       subprocess.call(['make','clean'])
-       os.rm('.config') # remove linux config file
-
-
 class mainThread(Thread):
        def __init__(self, name):
                Thread.__init__(self, name=name)
@@ -112,7 +96,4 @@ def main_loop():
 
 if __name__ == '__main__':
        signal.signal(signal.SIGTERM, sigterm_handler)
-       if sys.argv[1] == "reset":
-               reset()
-       else:
-               main_loop()
+       main_loop()
diff --git a/scripts/reset.py b/scripts/reset.py
new file mode 100755 (executable)
index 0000000..461bbda
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/python3
+import os
+import sys
+
+def rm_rf(d):
+       for path in (os.path.join(d,f) for f in os.listdir(d)):
+               if os.path.isdir(path):
+                       rm_rf(path)
+               else:
+                       os.unlink(path)
+               os.rmdir(d)
+
+# TODO repair, broken
+def reset():
+       rm_rf(conf.build_folder)
+       os.chdir(conf.linux_sources)
+       subprocess.call(['make','clean'])
+       os.rm('.config') # remove linux config file
+
+
+#################################################################################
+
+if __name__ == '__main__':
+       reset()