Add RT-Thread Root folder detection.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2495 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-12-18 10:31:13 +00:00
parent be73747fc4
commit 1fa210e6e3
2 changed files with 17 additions and 13 deletions

View File

@ -43,7 +43,7 @@ class CmdExecutor(threading.Thread):
self.child = None self.child = None
def run(self): def run(self):
global executor global executor, builder, lock
if platform.system() == 'Windows': if platform.system() == 'Windows':
from win32spawn import Win32Spawn from win32spawn import Win32Spawn
@ -182,6 +182,16 @@ class SconsUI():
if os.environ.has_key('RTT_ROOT'): if os.environ.has_key('RTT_ROOT'):
self.RTTRoot.set_path(os.environ['RTT_ROOT']) self.RTTRoot.set_path(os.environ['RTT_ROOT'])
if self.RTTRoot.get_path() == '':
rtt_root = ''
# detect RT-Thread directory
if os.path.exists(os.path.join('..', 'include', 'rtthread.h')):
rtt_root = os.path.join('..')
elif os.path.exists(os.path.join('..', '..', 'include', 'rtthread.h')):
rtt_root = os.path.join('..', '..')
if rtt_root:
self.RTTRoot.set_path(os.path.abspath(rtt_root))
# detect compiler path # detect compiler path
if platform.system() == 'Windows': if platform.system() == 'Windows':
# Keil MDK # Keil MDK
@ -388,22 +398,15 @@ class SconsUI():
exit(0) exit(0)
def StartSConsUI(path=None): def StartSConsUI(path=None):
global val, root global val, root, builder, lock
root = Tk() root = Tk()
root.title('RT-Thread SCons UI') root.title('RT-Thread SCons UI')
root.geometrygeometry('590x510+50+50') #root.geometrygeometry('590x510+50+50')
lock = threading.RLock() lock = threading.RLock()
builder = SconsUI(root) builder = SconsUI(root)
if path: if path:
builder.BSPRoot.set_path(path) builder.BSPRoot.set_path(path)
root.mainloop root.mainloop()
if __name__ == '__main__': if __name__ == '__main__':
global val, root StartSConsUI()
root = Tk()
root.title('scons_builder')
root.geometry('590x510+50+50')
lock = threading.RLock()
scons_ui = SconsUI(root)
builder = scons_ui
root.mainloop()

View File

@ -139,7 +139,8 @@ class Win32Spawn(object):
try: try:
finished = 0 finished = 0
hr, data = win32file.ReadFile(handle, bytesToRead, None) hr, data = win32file.ReadFile(handle, bytesToRead, None)
self.queue.put_nowait(data) if data:
self.queue.put_nowait(data)
except win32api.error: except win32api.error:
finished = 1 finished = 1