__init__.py
1 compiling = False 2 noticed = False 3 notice_delay = 0.3 4 import time 5 import sys 6 import threading 7 from importlib.util import find_spec 8 if find_spec("pyximport") and find_spec("cython"): 9 import pyximport; pyxloader = pyximport.install(pyimport=True, language_level=3)[1] 10 11 def notice_job(): 12 global noticed 13 started = time.time() 14 while compiling: 15 if time.time() > started+notice_delay and compiling: 16 noticed = True 17 print("Compiling RNS object code... ", end="") 18 sys.stdout.flush() 19 break 20 time.sleep(0.1) 21 22 23 compiling = True 24 threading.Thread(target=notice_job, daemon=True).start() 25 import RNS; compiling = False 26 if noticed: print("Done."); sys.stdout.flush()