|
@@ -1,28 +1,29 @@
|
|
|
import os
|
|
|
from sys import argv
|
|
|
-from threading import Thread
|
|
|
+from multiprocessing import Process, Queue
|
|
|
import apt
|
|
|
|
|
|
OUTPUT = ''
|
|
|
-LOLCAT = False
|
|
|
+LOLCAT = Queue()
|
|
|
|
|
|
-def check_lolcat():
|
|
|
- global LOLCAT
|
|
|
- LOLCAT = apt.Cache()['lolcat'].is_installed
|
|
|
- if LOLCAT: print('lolcat detected!')
|
|
|
+def check_lolcat(queue):
|
|
|
+ if apt.Cache()['lolcat'].is_installed:
|
|
|
+ queue.put(True)
|
|
|
+ print('lolcat detected!')
|
|
|
+ else: queue.put(False)
|
|
|
def echo(text):
|
|
|
global OUTPUT
|
|
|
OUTPUT += text + '\n'
|
|
|
def output_flush():
|
|
|
global OUTPUT
|
|
|
- os.system(f"echo \"{OUTPUT[:-1]}\"{'| /usr/games/lolcat' if LOLCAT else ''}")
|
|
|
+ os.system(f"echo \"{OUTPUT[:-1]}\"{'| /usr/games/lolcat' if LOLCAT.get() else ''}")
|
|
|
|
|
|
if os.getuid() != 0:
|
|
|
print('root rights required\nrun \'sudo python install.py\'')
|
|
|
exit(1)
|
|
|
path = 'src/ompl_src/'
|
|
|
-check_lolcat_thread = Thread(target=check_lolcat)
|
|
|
-check_lolcat_thread.start()
|
|
|
+check_lolcat_process = Process(target=check_lolcat, args=(LOLCAT,))
|
|
|
+check_lolcat_process.start()
|
|
|
if 'r' in argv:
|
|
|
os.system(f'rm {path}obj/ -rf')
|
|
|
os.system(f'rm {path}lib/ -rf')
|
|
@@ -55,5 +56,5 @@ if 'c' in argv:
|
|
|
os.system('rm src/ompl_src/lib/ -r | rm src/ompl_src/obj/ -r')
|
|
|
echo('=' * 13)
|
|
|
echo('done')
|
|
|
-check_lolcat_thread.join()
|
|
|
+check_lolcat_process.join()
|
|
|
output_flush()
|