Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SummerGao.
rt-thread
提交
eafcdd0b
R
rt-thread
项目概览
SummerGao.
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eafcdd0b
编写于
8月 02, 2022
作者:
mysterywolf
提交者:
mysterywolf
8月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[tools] format python code
上级
af82606d
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
345 addition
and
345 deletion
+345
-345
tools/WCS.py
tools/WCS.py
+1
-1
tools/building.py
tools/building.py
+3
-3
tools/cdk.py
tools/cdk.py
+4
-4
tools/codeblocks.py
tools/codeblocks.py
+12
-12
tools/codelite.py
tools/codelite.py
+35
-35
tools/eclipse.py
tools/eclipse.py
+1
-1
tools/file_check.py
tools/file_check.py
+5
-5
tools/keil.py
tools/keil.py
+2
-2
tools/makefile.py
tools/makefile.py
+1
-1
tools/menuconfig.py
tools/menuconfig.py
+6
-6
tools/mkromfs.py
tools/mkromfs.py
+1
-1
tools/package.py
tools/package.py
+1
-1
tools/rt_studio.py
tools/rt_studio.py
+183
-183
tools/sconsui.py
tools/sconsui.py
+52
-52
tools/ses.py
tools/ses.py
+2
-2
tools/ua.py
tools/ua.py
+5
-5
tools/utils.py
tools/utils.py
+3
-3
tools/vs.py
tools/vs.py
+9
-9
tools/vs2012.py
tools/vs2012.py
+5
-5
tools/win32spawn.py
tools/win32spawn.py
+7
-7
tools/wizard.py
tools/wizard.py
+4
-4
tools/xmake.py
tools/xmake.py
+3
-3
未找到文件。
tools/WCS.py
浏览文件 @
eafcdd0b
...
...
@@ -437,4 +437,4 @@ def ThreadStackStaticAnalysis(env):
main
()
print
(
'
\n
Thread stack static analysis done!'
)
return
\ No newline at end of file
return
tools/building.py
浏览文件 @
eafcdd0b
...
...
@@ -305,7 +305,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
menuconfig
(
Rtt_Root
)
exit
(
0
)
if
GetOption
(
'pyconfig_silent'
):
if
GetOption
(
'pyconfig_silent'
):
from
menuconfig
import
guiconfig_silent
guiconfig_silent
(
Rtt_Root
)
...
...
@@ -694,7 +694,7 @@ def PreBuilding():
a
()
def
GroupLibName
(
name
,
env
):
if
rtconfig
.
PLATFORM
==
'armcc'
:
return
name
+
'_rvds'
elif
rtconfig
.
PLATFORM
==
'gcc'
:
...
...
@@ -850,7 +850,7 @@ def GenTargetProject(program = None):
if
GetOption
(
'target'
)
==
'eclipse'
:
from
eclipse
import
TargetEclipse
TargetEclipse
(
Env
,
GetOption
(
'reset-project-config'
),
GetOption
(
'project-name'
))
if
GetOption
(
'target'
)
==
'codelite'
:
from
codelite
import
TargetCodelite
TargetCodelite
(
Projects
,
program
)
...
...
tools/cdk.py
浏览文件 @
eafcdd0b
...
...
@@ -68,7 +68,7 @@ def _CDKProject(tree, target, script):
for
child
in
root
:
if
child
.
tag
==
'VirtualDirectory'
:
root
.
remove
(
child
)
for
group
in
script
:
group_tree
=
SDKAddGroup
(
ProjectFiles
,
root
,
group
[
'name'
],
group
[
'src'
],
project_path
)
...
...
@@ -91,8 +91,8 @@ def _CDKProject(tree, target, script):
if
CCFLAGS
:
CCFLAGS
+=
' '
+
group
[
'CCFLAGS'
]
else
:
CCFLAGS
+=
group
[
'CCFLAGS'
]
CCFLAGS
+=
group
[
'CCFLAGS'
]
# get each group's link flags
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
if
LINKFLAGS
:
...
...
@@ -114,7 +114,7 @@ def _CDKProject(tree, target, script):
CC_Misc
=
tree
.
find
(
'BuildConfigs/BuildConfig/Compiler/OtherFlags'
)
CC_Misc
.
text
=
CCFLAGS
LK_Misc
=
tree
.
find
(
'BuildConfigs/BuildConfig/Linker/OtherFlags'
)
LK_Misc
.
text
=
LINKFLAGS
...
...
tools/codeblocks.py
浏览文件 @
eafcdd0b
...
...
@@ -40,10 +40,10 @@ def CB_AddHeadFiles(program, elem, project_path):
utils
.
source_ext
=
[]
utils
.
source_ext
=
[
"h"
]
for
item
in
program
:
utils
.
walk_children
(
item
)
utils
.
walk_children
(
item
)
utils
.
source_list
.
sort
()
# print utils.source_list
for
f
in
utils
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
Unit
=
SubElement
(
elem
,
'Unit'
)
...
...
@@ -70,14 +70,14 @@ def CBProject(target, script, program):
tree
=
etree
.
parse
(
'template.cbp'
)
else
:
tree
=
etree
.
parse
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'template.cbp'
))
root
=
tree
.
getroot
()
out
=
open
(
target
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
\n
'
)
ProjectFiles
=
[]
# SECTION 1. add "*.c|*.h" files group
for
elem
in
tree
.
iter
(
tag
=
'Project'
):
# print elem.tag, elem.attrib
...
...
@@ -88,7 +88,7 @@ def CBProject(target, script, program):
# add h files
CB_AddHeadFiles
(
program
,
elem
,
project_path
)
# SECTION 2.
# SECTION 2.
# write head include path
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
...
...
@@ -96,7 +96,7 @@ def CBProject(target, script, program):
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
# write include path, definitions
...
...
@@ -110,10 +110,10 @@ def CBProject(target, script, program):
Add
=
SubElement
(
elem
,
'Add'
)
for
d
in
macro
:
Add
.
set
(
'option'
,
"-D"
+
d
)
# write link flags
'''
# write lib dependence
# write lib dependence
if 'LIBS' in building.Env:
for elem in tree.iter(tag='Tool'):
if elem.attrib['Name'] == 'VCLinkerTool':
...
...
@@ -121,7 +121,7 @@ def CBProject(target, script, program):
libs_with_extention = [i+'.lib' for i in building.Env['LIBS']]
libs = ' '.join(libs_with_extention)
elem.set('AdditionalDependencies', libs)
# write lib include path
if 'LIBPATH' in building.Env:
lib_path = building.Env['LIBPATH']
...
...
@@ -129,7 +129,7 @@ def CBProject(target, script, program):
for path in lib_path:
inc = _make_path_relative(project_path, os.path.normpath(path))
paths.add(inc) #.replace('
\\
', '/')
paths = [i for i in paths]
paths.sort()
lib_paths = ';'.join(paths)
...
...
tools/codelite.py
浏览文件 @
eafcdd0b
...
...
@@ -40,15 +40,15 @@ fs_encoding = sys.getfilesystemencoding()
def
CLSetCFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'C_Options'
]
=
flags
def
CLSetCxxFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'Options'
]
=
flags
def
CLSetAsFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'Assembler'
]
=
flags
def
CLAddIncludePath
(
root
,
path
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
=
SubElement
(
node
,
'IncludePath'
)
...
...
@@ -58,22 +58,22 @@ def CLAddPreprocessor(root, value):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
=
SubElement
(
node
,
'Preprocessor'
)
node
.
attrib
[
'Value'
]
=
value
def
CLSetLdFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
.
attrib
[
'Options'
]
=
flags
def
CLAddLibrary_path
(
root
,
path
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
=
SubElement
(
node
,
'LibraryPath'
)
node
.
attrib
[
'Value'
]
=
path
def
CLAddLibrary
(
root
,
lib
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
=
SubElement
(
node
,
'Library'
)
node
.
attrib
[
'Value'
]
=
lib
def
CLAddFile
(
root
,
file_path
):
file_path
=
file_path
.
replace
(
'
\\
'
,
'/'
)
...
...
@@ -81,12 +81,12 @@ def CLAddFile(root, file_path):
dir_list
.
pop
()
if
not
len
(
dir_list
):
dir_list
.
append
(
os
.
path
.
abspath
(
'.'
).
replace
(
'
\\
'
,
'/'
).
split
(
'/'
)[
-
1
])
parent
=
root
for
dir_name
in
dir_list
:
if
dir_name
==
'..'
:
continue
node
=
None
nodes
=
parent
.
findall
(
'VirtualDirectory'
)
for
iter
in
nodes
:
...
...
@@ -101,18 +101,18 @@ def CLAddFile(root, file_path):
if
parent
!=
root
:
node
=
SubElement
(
parent
,
'File'
)
node
.
attrib
[
'Name'
]
=
file_path
def
CLAddHeaderFiles
(
parent
,
program
,
project_path
):
utils
.
source_ext
=
[]
utils
.
source_ext
=
[
"h"
]
for
item
in
program
:
utils
.
walk_children
(
item
)
utils
.
source_list
.
sort
()
for
f
in
utils
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
CLAddFile
(
parent
,
path
)
def
CLAddCFiles
(
parent
,
files
,
project_path
):
for
f
in
files
:
fn
=
f
.
rfile
()
...
...
@@ -122,81 +122,81 @@ def CLAddCFiles(parent, files, project_path):
path
=
_make_path_relative
(
project_path
,
path
)
path
=
os
.
path
.
join
(
path
,
name
)
CLAddFile
(
parent
,
path
)
def
CLGenWorkspace
(
project_name
,
project_path
):
if
os
.
path
.
isfile
(
'codelite_template.workspace'
):
tree
=
etree
.
parse
(
'codelite_template.workspace'
)
else
:
tree
=
etree
.
parse
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'codelite_template.workspace'
))
root
=
tree
.
getroot
()
root
.
attrib
[
'Name'
]
=
project_name
node
=
root
.
find
(
'Project'
)
node
.
attrib
[
'Name'
]
=
project_name
node
.
attrib
[
'Path'
]
=
project_name
+
'.project'
node
=
root
.
find
(
'BuildMatrix'
).
find
(
'WorkspaceConfiguration'
).
find
(
'Project'
)
node
.
attrib
[
'Name'
]
=
project_name
out
=
open
(
project_name
+
'.workspace'
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
close
()
def
TargetCodelite
(
script
,
program
):
project_name
=
os
.
path
.
abspath
(
'.'
).
replace
(
'
\\
'
,
'/'
).
split
(
'/'
)[
-
1
]
#project_name.replace('-', '_')
project_path
=
os
.
path
.
abspath
(
'.'
)
CLGenWorkspace
(
project_name
,
project_path
)
if
os
.
path
.
isfile
(
'codelite_template.project'
):
tree
=
etree
.
parse
(
'codelite_template.project'
)
else
:
tree
=
etree
.
parse
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'codelite_template.project'
))
root
=
tree
.
getroot
()
root
.
attrib
[
'Name'
]
=
project_name
out
=
open
(
project_name
+
'.project'
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
# add files
for
group
in
script
:
CLAddCFiles
(
root
,
group
[
'src'
],
project_path
)
# add header file
CLAddHeaderFiles
(
root
,
program
,
project_path
)
# SECTION 2.
# SECTION 2.
# write head include path
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
# write include path, definitions
for
elem
in
tree
.
iter
(
tag
=
'Compiler'
):
break
for
path
in
paths
:
CLAddIncludePath
(
root
,
path
)
#print building.Env.get('LIBPATH', [])
#print building.Env.get('LIBS', [])
CLSetCFlags
(
root
,
building
.
Env
.
get
(
'CFLAGS'
,
[]))
CLSetCxxFlags
(
root
,
building
.
Env
.
get
(
'CFLAGS'
,
[]))
asflags
=
building
.
Env
.
get
(
'ASFLAGS'
,
[])
asflags
=
asflags
.
replace
(
'-ffunction-sections'
,
''
)
asflags
=
asflags
.
replace
(
'-fdata-sections'
,
''
)
...
...
@@ -205,11 +205,11 @@ def TargetCodelite(script, program):
asflags
=
asflags
.
replace
(
'assembler-with-cpp'
,
''
)
CLSetAsFlags
(
root
,
asflags
)
CLSetLdFlags
(
root
,
building
.
Env
.
get
(
'LINKFLAGS'
,
[]))
for
macro
in
building
.
Env
.
get
(
'CPPDEFINES'
,
[]):
for
d
in
macro
:
CLAddPreprocessor
(
root
,
d
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
close
()
tools/eclipse.py
浏览文件 @
eafcdd0b
#
# Copyright (c) 2006-20
19
, RT-Thread Development Team
# Copyright (c) 2006-20
22
, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
...
...
tools/file_check.py
浏览文件 @
eafcdd0b
#
# Copyright (c) 2006-202
1
, RT-Thread Development Team
# Copyright (c) 2006-202
2
, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
...
...
@@ -65,7 +65,7 @@ class CheckOut:
if
file_real_path
==
file_path
:
logging
.
info
(
"ignore file path: {}"
.
format
(
file_real_path
))
return
0
file_dir_path
=
os
.
path
.
dirname
(
file_path
)
for
_dir
in
dir_ignore
:
if
_dir
is
not
None
:
...
...
@@ -168,7 +168,7 @@ class FormatCheck:
with
open
(
file_path
,
'r'
,
encoding
=
"utf-8"
)
as
f
:
file_lines
=
f
.
readlines
()
if
not
self
.
__check_file
(
file_lines
,
file_path
):
format_check_fail_files
+=
1
format_check_fail_files
+=
1
if
(
not
encoding_check_result
)
or
(
format_check_fail_files
!=
0
):
logging
.
error
(
"files format check fail."
)
...
...
@@ -209,12 +209,12 @@ class LicenseCheck:
logging
.
warning
(
"[{0}]: license year: {} is not true: {}, please update."
.
format
(
file_path
,
license_year
,
true_year
))
else
:
logging
.
info
(
"[{0}]: license check success."
.
format
(
file_path
))
except
Exception
as
e
:
logging
.
error
(
e
)
else
:
logging
.
error
(
"[{0}]: license check fail."
.
format
(
file_path
))
check_result
=
False
...
...
tools/keil.py
浏览文件 @
eafcdd0b
...
...
@@ -208,7 +208,7 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path, group_scons):
return
group
# The common part of making MDK4/5 project
# The common part of making MDK4/5 project
def
MDK45Project
(
tree
,
target
,
script
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
...
...
@@ -437,7 +437,7 @@ def ARMCC_Version():
stdout
,
stderr
=
child
.
communicate
()
'''
example stdout:
example stdout:
Product: MDK Plus 5.24
Component: ARM Compiler 5.06 update 5 (build 528)
Tool: armcc [4d3621]
...
...
tools/makefile.py
浏览文件 @
eafcdd0b
...
...
@@ -27,7 +27,7 @@ def TargetMakefile(env):
RTT_ROOT = os.path.abspath(env['
RTT_ROOT
'])
match_bsp = False
if BSP_ROOT.startswith(RTT_ROOT):
if BSP_ROOT.startswith(RTT_ROOT):
match_bsp = True
make = open('
config.mk
', '
w
')
...
...
tools/menuconfig.py
浏览文件 @
eafcdd0b
...
...
@@ -150,7 +150,7 @@ def touch_env():
home_dir
=
os
.
environ
[
'HOME'
]
else
:
home_dir
=
os
.
environ
[
'USERPROFILE'
]
package_url
=
os
.
getenv
(
'RTT_PACKAGE_URL'
)
or
DEFAULT_RTT_PACKAGE_URL
env_dir
=
os
.
path
.
join
(
home_dir
,
'.env'
)
...
...
@@ -223,7 +223,7 @@ def touch_env():
if
os
.
path
.
exists
(
os
.
path
.
join
(
env_dir
,
'tools'
,
'scripts'
)):
os
.
environ
[
"PATH"
]
=
os
.
path
.
join
(
env_dir
,
'tools'
,
'scripts'
)
+
';'
+
os
.
environ
[
"PATH"
]
# Exclude utestcases
# Exclude utestcases
def
exclude_utestcases
(
RTT_ROOT
):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
RTT_ROOT
,
'examples/utest/testcases/Kconfig'
)):
return
...
...
@@ -241,7 +241,7 @@ def exclude_utestcases(RTT_ROOT):
# menuconfig for Linux
def
menuconfig
(
RTT_ROOT
):
# Exclude utestcases
# Exclude utestcases
exclude_utestcases
(
RTT_ROOT
)
kconfig_dir
=
os
.
path
.
join
(
RTT_ROOT
,
'tools'
,
'kconfig-frontends'
)
...
...
@@ -275,7 +275,7 @@ def menuconfig(RTT_ROOT):
def
guiconfig
(
RTT_ROOT
):
import
pyguiconfig
# Exclude utestcases
# Exclude utestcases
exclude_utestcases
(
RTT_ROOT
)
if
sys
.
platform
!=
'win32'
:
...
...
@@ -309,9 +309,9 @@ def guiconfig(RTT_ROOT):
def
guiconfig_silent
(
RTT_ROOT
):
import
defconfig
# Exclude utestcases
# Exclude utestcases
exclude_utestcases
(
RTT_ROOT
)
if
sys
.
platform
!=
'win32'
:
touch_env
()
...
...
tools/mkromfs.py
浏览文件 @
eafcdd0b
...
...
@@ -172,7 +172,7 @@ class Folder(object):
# rt_uint32_t type;
# const char *name;
# const rt_uint8_t *data;
# rt_size_t size;
# rt_size_t size;
#}
d_li
=
[]
# payload base
...
...
tools/package.py
浏览文件 @
eafcdd0b
...
...
@@ -46,7 +46,7 @@ def BuildPackage(package):
package
=
json
.
loads
(
package_json
)
# check package name
# check package name
if
'name'
not
in
package
:
return
[]
...
...
tools/rt_studio.py
浏览文件 @
eafcdd0b
此差异已折叠。
点击以展开。
tools/sconsui.py
浏览文件 @
eafcdd0b
...
...
@@ -62,19 +62,19 @@ lock = None
class
CmdExecutor
(
threading
.
Thread
):
def
__init__
(
self
,
cmd
,
output
):
threading
.
Thread
.
__init__
(
self
)
threading
.
Thread
.
__init__
(
self
)
self
.
cmd
=
cmd
self
.
child
=
None
def
run
(
self
):
global
executor
,
builder
,
lock
if
platform
.
system
()
==
'Windows'
:
try
:
from
win32spawn
import
Win32Spawn
subprocess
=
Win32Spawn
(
self
.
cmd
)
subprocess
.
start_pipe
()
builder
.
progressbar
.
start
()
while
not
subprocess
.
is_terminated
or
subprocess
.
qsize
()
>
0
:
try
:
...
...
@@ -87,7 +87,7 @@ class CmdExecutor(threading.Thread):
lock
.
release
()
except
:
pass
builder
.
progressbar
.
stop
()
except
:
pass
...
...
@@ -113,7 +113,7 @@ class DirSelectBox(ttk.Frame):
self
.
entry
=
ttk
.
Entry
(
self
,
textvariable
=
self
.
dir_var
)
self
.
entry
.
pack
(
fill
=
BOTH
,
expand
=
1
,
side
=
LEFT
)
self
.
entry
.
configure
(
width
=
50
)
self
.
browser_button
=
ttk
.
Button
(
self
,
text
=
"Browser"
,
command
=
self
.
browser
)
self
.
browser_button
.
pack
(
side
=
RIGHT
)
...
...
@@ -125,7 +125,7 @@ class DirSelectBox(ttk.Frame):
def
set_path
(
self
,
path
):
path
=
path
.
replace
(
'
\\
'
,
'/'
)
self
.
dir_var
.
set
(
path
)
def
get_path
(
self
):
return
self
.
dir_var
.
get
()
...
...
@@ -147,31 +147,31 @@ class SconsUI():
theme
=
style
.
theme_use
()
default
=
style
.
lookup
(
theme
,
'background'
)
master
.
configure
(
background
=
default
)
notebook
=
ttk
.
Notebook
(
master
)
notebook
.
pack
(
fill
=
BOTH
,
padx
=
5
,
pady
=
5
)
# building page
# building page
page_building
=
ttk
.
Frame
(
notebook
)
notebook
.
add
(
page_building
,
padding
=
3
)
notebook
.
tab
(
0
,
text
=
'Build'
,
underline
=
"-1"
)
self
.
setup_building_ui
(
page_building
)
self
.
building_page
=
page_building
# make project page
page_project
=
ttk
.
Frame
(
notebook
)
notebook
.
add
(
page_project
,
padding
=
3
)
notebook
.
tab
(
1
,
text
=
'Project'
,
underline
=
'-1'
)
self
.
setup_project_ui
(
page_project
)
self
.
project_page
=
page_project
# setting page
# setting page
page_setting
=
ttk
.
Frame
(
notebook
)
notebook
.
add
(
page_setting
,
padding
=
3
)
notebook
.
tab
(
2
,
text
=
'Setting'
,
underline
=
'-1'
)
self
.
setup_setting_ui
(
page_setting
)
self
.
setting_page
=
page_setting
padding
=
ttk
.
Frame
(
master
)
padding
.
pack
(
fill
=
X
)
quit
=
ttk
.
Button
(
padding
,
text
=
'Quit'
,
command
=
self
.
quit
)
...
...
@@ -179,15 +179,15 @@ class SconsUI():
# set notebook to self
self
.
notebook
=
notebook
# read setting
# read setting
self
.
read_setting
()
self
.
is_makeing_project
=
False
def
read_setting
(
self
):
import
platform
import
os
home
=
''
if
platform
.
system
()
==
'Windows'
:
driver
=
os
.
environ
[
'HOMEDRIVE'
]
...
...
@@ -195,7 +195,7 @@ class SconsUI():
home
=
os
.
path
.
join
(
driver
,
home
)
else
:
home
=
os
.
environ
[
'HOME'
]
setting_path
=
os
.
path
.
join
(
home
,
'.rtt_scons'
)
if
os
.
path
.
exists
(
setting_path
):
setting
=
open
(
os
.
path
.
join
(
home
,
'.rtt_scons'
))
...
...
@@ -217,10 +217,10 @@ class SconsUI():
# set RT-Thread Root Directory according environ
if
'RTT_ROOT'
in
os
.
environ
:
self
.
RTTRoot
.
set_path
(
os
.
environ
[
'RTT_ROOT'
])
if
self
.
RTTRoot
.
get_path
()
==
''
:
rtt_root
=
''
# detect RT-Thread directory
# 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'
)):
...
...
@@ -247,7 +247,7 @@ class SconsUI():
if
not
self
.
CompilersPath
[
'GCC'
].
get_path
():
paths
=
os
.
environ
[
'PATH'
]
paths
=
paths
.
split
(
';'
)
for
path
in
paths
:
if
path
.
find
(
'CodeSourcery'
)
!=
-
1
:
self
.
CompilersPath
[
'GCC'
].
set_path
(
path
)
...
...
@@ -269,7 +269,7 @@ class SconsUI():
home
=
os
.
environ
[
'HOME'
]
setting
=
open
(
os
.
path
.
join
(
home
,
'.rtt_scons'
),
'w+'
)
# current comiler
# current comiler
# line = '%s=%s\n' % ('compiler', self.compilers.get()))
line
=
'%s=%s
\n
'
%
(
'compiler'
,
'iar'
)
setting
.
write
(
line
)
...
...
@@ -296,17 +296,17 @@ class SconsUI():
def
setup_building_ui
(
self
,
frame
):
padding
=
ttk
.
Frame
(
frame
)
padding
.
pack
(
fill
=
X
)
button
=
ttk
.
Button
(
padding
,
text
=
'Clean'
,
command
=
self
.
do_clean
)
button
.
pack
(
side
=
RIGHT
)
button
=
ttk
.
Button
(
padding
,
text
=
'Build'
,
command
=
self
.
do_build
)
button
.
pack
(
side
=
RIGHT
)
label
=
ttk
.
Label
(
padding
,
relief
=
'flat'
,
text
=
'Click Build or Clean to build or clean system -->'
)
label
.
pack
(
side
=
RIGHT
,
ipady
=
5
)
self
.
progressbar
=
ttk
.
Progressbar
(
frame
)
self
.
progressbar
.
pack
(
fill
=
X
)
separator
=
ttk
.
Separator
(
frame
)
separator
.
pack
(
fill
=
X
)
...
...
@@ -316,17 +316,17 @@ class SconsUI():
def
setup_project_ui
(
self
,
frame
):
label
=
ttk
.
Label
(
frame
,
relief
=
'flat'
,
text
=
'Choose Integrated Development Environment:'
)
label
.
pack
(
fill
=
X
,
pady
=
5
)
separator
=
ttk
.
Separator
(
frame
)
separator
.
pack
(
fill
=
X
)
self
.
ide
=
StringVar
()
self
.
ide
.
set
(
"mdk4"
)
# initialize
for
text
,
mode
in
IDE
:
radiobutton
=
ttk
.
Radiobutton
(
frame
,
text
=
text
,
variable
=
self
.
ide
,
value
=
mode
)
radiobutton
.
pack
(
fill
=
X
,
padx
=
10
)
bottom
=
ttk
.
Frame
(
frame
)
bottom
.
pack
(
side
=
BOTTOM
,
fill
=
X
)
button
=
ttk
.
Button
(
bottom
,
text
=
"Make Project"
,
command
=
self
.
do_make_project
)
...
...
@@ -336,26 +336,26 @@ class SconsUI():
row
=
0
label
=
ttk
.
Label
(
frame
,
relief
=
'flat'
,
text
=
'RT-Thread Root Folder:'
)
label
.
grid
(
row
=
row
,
column
=
0
,
ipadx
=
5
,
ipady
=
5
,
padx
=
5
)
self
.
RTTRoot
=
DirSelectBox
(
frame
)
self
.
RTTRoot
.
grid
(
row
=
row
,
column
=
1
,
sticky
=
E
+
W
)
row
=
row
+
1
label
=
ttk
.
Label
(
frame
,
relief
=
'flat'
,
text
=
'Board Support Folder:'
)
label
.
grid
(
row
=
row
,
column
=
0
,
ipadx
=
5
,
ipady
=
5
,
padx
=
5
)
self
.
BSPRoot
=
DirSelectBox
(
frame
)
self
.
BSPRoot
.
grid
(
row
=
row
,
column
=
1
,
sticky
=
E
+
W
)
row
=
row
+
1
label
=
ttk
.
Label
(
frame
,
relief
=
'flat'
,
text
=
'Toolchain:'
)
label
.
grid
(
row
=
row
,
column
=
0
,
ipadx
=
5
,
ipady
=
5
,
sticky
=
E
+
W
)
row
=
row
+
1
separator
=
ttk
.
Separator
(
frame
)
separator
.
grid
(
row
=
row
,
column
=
0
,
columnspan
=
2
,
sticky
=
E
+
W
)
row
=
row
+
1
self
.
compilers
=
StringVar
()
self
.
compilers
.
set
(
"GCC"
)
# initialize
...
...
@@ -368,13 +368,13 @@ class SconsUI():
self
.
CompilersPath
[
compiler
]
=
DirSelectBox
(
frame
)
self
.
CompilersPath
[
compiler
].
grid
(
row
=
row
,
column
=
1
,
sticky
=
E
+
W
)
row
=
row
+
1
button
=
ttk
.
Button
(
frame
,
text
=
'Save Setting'
,
command
=
self
.
save_setting
)
button
.
grid
(
row
=
row
,
column
=
1
,
sticky
=
E
)
row
=
row
+
1
def
prepare_build
(
self
):
# get compiler
# get compiler
compiler
=
self
.
compilers
.
get
()
if
compiler
==
'GCC'
:
compiler
=
'gcc'
...
...
@@ -385,26 +385,26 @@ class SconsUI():
# get RTT Root
rtt_root
=
self
.
RTTRoot
.
get_path
()
# get Compiler path
# get Compiler path
exec_path
=
self
.
CompilersPath
[
self
.
compilers
.
get
()].
get_path
()
command
=
''
os
.
environ
[
'RTT_ROOT'
]
=
rtt_root
os
.
environ
[
'RTT_CC'
]
=
compiler
os
.
environ
[
'RTT_EXEC_PATH'
]
=
exec_path
return
command
return
command
def
check_path
(
self
):
result
=
True
if
self
.
BSPRoot
.
get_path
()
==
''
:
result
=
False
if
self
.
RTTRoot
.
get_path
()
==
''
:
result
=
False
if
not
result
:
tkMessageBox
.
showinfo
(
"RT-Thread SCons UI"
,
"Folder is empty, please choose correct directory."
)
...
...
@@ -423,8 +423,8 @@ class SconsUI():
self
.
output
.
delete
(
1.0
,
END
)
self
.
output
.
insert
(
END
,
'building project...
\n
'
)
ExecCmd
(
command
)
ExecCmd
(
command
)
def
do_clean
(
self
):
self
.
prepare_build
()
command
=
'scons -c'
...
...
@@ -438,18 +438,18 @@ class SconsUI():
self
.
output
.
delete
(
1.0
,
END
)
self
.
output
.
insert
(
END
,
'clean project...
\n
'
)
ExecCmd
(
command
)
def
do_make_project
(
self
):
ide
=
self
.
ide
.
get
()
self
.
prepare_build
()
command
=
'scons --target=%s -s'
%
ide
if
not
self
.
check_path
():
return
# select build page
# select build page
self
.
notebook
.
select
(
self
.
building_page
)
bsp
=
self
.
BSPRoot
.
get_path
()
os
.
chdir
(
bsp
)
...
...
tools/ses.py
浏览文件 @
eafcdd0b
...
...
@@ -37,7 +37,7 @@ def SESProject(env) :
project
=
ProjectInfo
(
env
)
# print(project)
# return
# return
project_path
=
os
.
path
.
abspath
(
env
[
'BSP_ROOT'
])
script
=
env
[
'project'
]
...
...
@@ -64,7 +64,7 @@ def SESProject(env) :
CFLAGS
+=
' '
+
group
[
'CFLAGS'
]
else
:
CFLAGS
+=
group
[
'CFLAGS'
]
# get each group's link flags
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
if
LINKFLAGS
:
...
...
tools/ua.py
浏览文件 @
eafcdd0b
...
...
@@ -36,7 +36,7 @@ def PrefixPath(prefix, path):
if
path
.
startswith
(
prefix
):
return
True
return
False
def
PrepareUA
(
project
,
RTT_ROOT
,
BSP_ROOT
):
...
...
@@ -44,9 +44,9 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
# ua.write('import os\n')
# ua.write('import sys\n')
ua
.
write
(
'
\n
'
)
print
(
RTT_ROOT
)
CPPPATH
=
[]
CPPDEFINES
=
[]
...
...
@@ -60,7 +60,7 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
if
len
(
CPPPATH
):
# use absolute path
# use absolute path
for
i
in
range
(
len
(
CPPPATH
)):
CPPPATH
[
i
]
=
os
.
path
.
abspath
(
CPPPATH
[
i
])
...
...
@@ -70,7 +70,7 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
for
path
in
paths
:
if
PrefixPath
(
RTT_ROOT
,
path
):
CPPPATH
+=
[
'RTT_ROOT + "/%s",'
%
_make_path_relative
(
RTT_ROOT
,
path
).
replace
(
'
\\
'
,
'/'
)]
elif
PrefixPath
(
BSP_ROOT
,
path
):
CPPPATH
+=
[
'BSP_ROOT + "/%s",'
%
_make_path_relative
(
BSP_ROOT
,
path
).
replace
(
'
\\
'
,
'/'
)]
else
:
...
...
tools/utils.py
浏览文件 @
eafcdd0b
...
...
@@ -139,7 +139,7 @@ def PrefixPath(prefix, path):
if
path
.
startswith
(
prefix
):
return
True
return
False
def
ListMap
(
l
):
...
...
@@ -197,7 +197,7 @@ def ProjectInfo(env):
# process FILES and DIRS
if
len
(
FILES
):
# use absolute path
# use absolute path
for
i
in
range
(
len
(
FILES
)):
FILES
[
i
]
=
os
.
path
.
abspath
(
str
(
FILES
[
i
]))
DIRS
.
append
(
os
.
path
.
dirname
(
FILES
[
i
]))
...
...
@@ -211,7 +211,7 @@ def ProjectInfo(env):
# process CPPPATH
if
len
(
CPPPATH
):
# use absolute path
# use absolute path
for
i
in
range
(
len
(
CPPPATH
)):
CPPPATH
[
i
]
=
os
.
path
.
abspath
(
CPPPATH
[
i
])
...
...
tools/vs.py
浏览文件 @
eafcdd0b
...
...
@@ -70,10 +70,10 @@ def VS_AddHeadFilesGroup(program, elem, project_path):
utils
.
source_ext
=
[]
utils
.
source_ext
=
[
"h"
]
for
item
in
program
:
utils
.
walk_children
(
item
)
utils
.
walk_children
(
item
)
utils
.
source_list
.
sort
()
# print utils.source_list
for
f
in
utils
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
File
=
SubElement
(
elem
,
'File'
)
...
...
@@ -85,15 +85,15 @@ def VS_AddHeadFilesGroup(program, elem, project_path):
def
VSProject
(
target
,
script
,
program
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
tree
=
etree
.
parse
(
'template_vs2005.vcproj'
)
root
=
tree
.
getroot
()
out
=
open
(
target
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\r\n
'
)
ProjectFiles
=
[]
# add "*.c" files group
for
elem
in
tree
.
iter
(
tag
=
'Filter'
):
if
elem
.
attrib
[
'Name'
]
==
'Source Files'
:
...
...
@@ -120,7 +120,7 @@ def VSProject(target, script, program):
if
elem
.
attrib
[
'Name'
]
==
'Header Files'
:
break
VS_AddHeadFilesGroup
(
program
,
elem
,
project_path
)
# write head include path
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
...
...
@@ -128,7 +128,7 @@ def VSProject(target, script, program):
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
cpp_path
=
';'
.
join
(
paths
)
...
...
@@ -153,7 +153,7 @@ def VSProject(target, script, program):
elem
.
set
(
'PreprocessorDefinitions'
,
definitions
)
# write link flags
# write lib dependence
# write lib dependence
if
'LIBS'
in
building
.
Env
:
for
elem
in
tree
.
iter
(
tag
=
'Tool'
):
if
elem
.
attrib
[
'Name'
]
==
'VCLinkerTool'
:
...
...
tools/vs2012.py
浏览文件 @
eafcdd0b
...
...
@@ -49,7 +49,7 @@ def get_uuid():
else
:
# python3 is no decode function
idstr
=
id
.
get_urn
()[
9
:]
#'urn:uuid:3e5526c0-2841-11e3-a376-20cf3048bcb3'[9:]
return
'{'
+
idstr
+
'}'
def
VS2012_AddGroup
(
parent
,
group_name
,
files
,
project_path
):
...
...
@@ -144,7 +144,7 @@ def VS_add_HeadFiles(program, elem, project_path):
utils
.
source_ext
=
[]
utils
.
source_ext
=
[
"h"
]
for
item
in
program
:
utils
.
walk_children
(
item
)
utils
.
walk_children
(
item
)
utils
.
source_list
.
sort
()
# print utils.source_list
ItemGroup
=
SubElement
(
elem
,
'ItemGroup'
)
...
...
@@ -174,7 +174,7 @@ def VS_add_HeadFiles(program, elem, project_path):
def
VS2012Project
(
target
,
script
,
program
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
tree
=
etree
.
parse
(
'template_vs2012.vcxproj'
)
root
=
tree
.
getroot
()
elem
=
root
...
...
@@ -201,7 +201,7 @@ def VS2012Project(target, script, program):
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
cpp_path
=
';'
.
join
(
paths
)
+
';%(AdditionalIncludeDirectories)'
...
...
@@ -243,7 +243,7 @@ def VS2012Project(target, script, program):
for
path
in
lib_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
lib_paths
=
';'
.
join
(
paths
)
+
';%(AdditionalLibraryDirectories)'
...
...
tools/win32spawn.py
浏览文件 @
eafcdd0b
...
...
@@ -32,7 +32,7 @@ if _PY2:
else
:
import
queue
as
Queue
# Windows import
# Windows import
import
win32file
import
win32pipe
import
win32api
...
...
@@ -46,11 +46,11 @@ class Win32Spawn(object):
self
.
queue
=
Queue
.
Queue
()
self
.
is_terminated
=
False
self
.
wake_up_event
=
win32event
.
CreateEvent
(
None
,
0
,
0
,
None
)
exec_dir
=
os
.
getcwd
()
comspec
=
os
.
environ
.
get
(
"COMSPEC"
,
"cmd.exe"
)
cmd
=
comspec
+
' /c '
+
cmd
win32event
.
ResetEvent
(
self
.
wake_up_event
)
currproc
=
win32api
.
GetCurrentProcess
()
...
...
@@ -83,7 +83,7 @@ class Win32Spawn(object):
self
.
h_process
,
h_thread
,
dw_pid
,
dw_tid
=
win32process
.
CreateProcess
(
None
,
cmd
,
None
,
None
,
1
,
cr_flags
,
env
,
os
.
path
.
abspath
(
exec_dir
),
startup_info
)
win32api
.
CloseHandle
(
h_thread
)
win32file
.
CloseHandle
(
child_stdin_rd
)
...
...
@@ -115,7 +115,7 @@ class Win32Spawn(object):
else
:
# The wake_up_event must have been signalled
return
False
def
get
(
self
,
block
=
True
,
timeout
=
None
):
return
self
.
queue
.
get
(
block
=
block
,
timeout
=
timeout
)
...
...
@@ -158,7 +158,7 @@ class Win32Spawn(object):
result
=
self
.
exit_code
==
0
self
.
close
()
self
.
is_terminated
=
True
return
result
# This method gets called on a worker thread to read from either a stderr
...
...
@@ -180,6 +180,6 @@ class Win32Spawn(object):
def
start_pipe
(
self
):
def
worker
(
pipe
):
return
pipe
.
wait
()
thrd
=
threading
.
Thread
(
target
=
worker
,
args
=
(
self
,
))
thrd
.
start
()
tools/wizard.py
浏览文件 @
eafcdd0b
...
...
@@ -26,11 +26,11 @@
#
"""
wizard.py - a script to generate SConscript in RT-Thread RTOS.
wizard.py - a script to generate SConscript in RT-Thread RTOS.
`wizard --component name' to generate SConscript for name component.
`wizard --bridge' to generate SConscript as a bridge to connect each
SConscript script file of sub-directory.
`wizard --bridge' to generate SConscript as a bridge to connect each
SConscript script file of sub-directory.
"""
import
sys
...
...
@@ -86,7 +86,7 @@ if __name__ == '__main__':
if
len
(
sys
.
argv
)
==
1
:
usage
()
sys
.
exit
(
2
)
if
sys
.
argv
[
1
]
==
'--component'
:
gen_component
(
sys
.
argv
[
2
])
elif
sys
.
argv
[
1
]
==
'--bridge'
:
...
...
tools/xmake.py
浏览文件 @
eafcdd0b
...
...
@@ -71,8 +71,8 @@ class XmakeProject:
with
open
(
template_path
,
"r"
)
as
f
:
data
=
f
.
read
()
data
=
Template
(
data
)
data
=
data
.
safe_substitute
(
toolchain
=
self
.
toolchain
,
sdkdir
=
self
.
sdkdir
,
src_path
=
self
.
src_path
,
inc_path
=
self
.
inc_path
,
define
=
self
.
define
,
cflags
=
self
.
cflags
,
cxxflags
=
self
.
cxxflags
,
asflags
=
self
.
asflags
,
data
=
data
.
safe_substitute
(
toolchain
=
self
.
toolchain
,
sdkdir
=
self
.
sdkdir
,
src_path
=
self
.
src_path
,
inc_path
=
self
.
inc_path
,
define
=
self
.
define
,
cflags
=
self
.
cflags
,
cxxflags
=
self
.
cxxflags
,
asflags
=
self
.
asflags
,
ldflags
=
self
.
ldflags
,
target
=
"rt-thread"
)
with
open
(
"xmake.lua"
,
"w"
)
as
f
:
f
.
write
(
data
)
...
...
@@ -88,4 +88,4 @@ def XMakeProject(env,project):
print
(
'Done!'
)
return
\ No newline at end of file
return
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录