[Tools] Change building script for Py3

This commit is contained in:
Bernard Xiong 2018-11-10 18:29:08 +08:00
parent b69baa9658
commit d687cfb228
15 changed files with 150 additions and 87 deletions

View File

@ -27,6 +27,7 @@
import os
import sys
import string
import utils
from SCons.Script import *
from utils import _make_path_relative
@ -233,7 +234,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
rtconfig.CROSS_TOOL, rtconfig.PLATFORM = tgt_dict[tgt_name]
# replace the 'RTT_CC' to 'CROSS_TOOL'
os.environ['RTT_CC'] = rtconfig.CROSS_TOOL
reload(rtconfig)
utils.ReloadModule(rtconfig)
except KeyError:
print ('Unknow target: '+ tgt_name+'. Avaible targets: ' +', '.join(tgt_dict.keys()))
sys.exit(1)
@ -246,7 +247,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
if 'RTT_EXEC_PATH' in os.environ:
# del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
del os.environ['RTT_EXEC_PATH']
reload(rtconfig)
utils.ReloadModule(rtconfig)
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
if rtconfig.PLATFORM == 'armcc':
@ -407,7 +408,7 @@ def PrepareModuleBuilding(env, root_directory, bsp_directory):
# parse bsp rtconfig.h to get used component
PreProcessor = PatchedPreProcessor()
f = file(bsp_directory + '/rtconfig.h', 'r')
f = open(bsp_directory + '/rtconfig.h', 'r')
contents = f.read()
f.close()
PreProcessor.process_contents(contents)
@ -458,7 +459,7 @@ def LocalOptions(config_filename):
# parse wiced_config.h to get used component
PreProcessor = SCons.cpp.PreProcessor()
f = file(config_filename, 'r')
f = open(config_filename, 'r')
contents = f.read()
f.close()
@ -573,6 +574,10 @@ def DefineGroup(name, src, depend, **parameters):
if 'CCFLAGS' in group:
Env.AppendUnique(CCFLAGS = group['CCFLAGS'])
if 'CPPPATH' in group:
paths = []
for item in group['CPPPATH']:
paths.append(os.path.abspath(item))
group['CPPPATH'] = paths
Env.AppendUnique(CPPPATH = group['CPPPATH'])
if 'CPPDEFINES' in group:
Env.AppendUnique(CPPDEFINES = group['CPPDEFINES'])
@ -580,6 +585,18 @@ def DefineGroup(name, src, depend, **parameters):
Env.AppendUnique(LINKFLAGS = group['LINKFLAGS'])
if 'ASFLAGS' in group:
Env.AppendUnique(ASFLAGS = group['ASFLAGS'])
if 'LOCAL_CPPPATH' in group:
paths = []
for item in group['LOCAL_CPPPATH']:
paths.append(os.path.abspath(item))
group['LOCAL_CPPPATH'] = paths
import rtconfig
if rtconfig.PLATFORM == 'gcc':
if 'CCFLAGS' in group:
group['CCFLAGS'] = utils.GCCC99Patch(group['CCFLAGS'])
if 'LOCAL_CCFLAGS' in group:
group['LOCAL_CCFLAGS'] = utils.GCCC99Patch(group['LOCAL_CCFLAGS'])
# check whether to clean up library
if GetOption('cleanlib') and os.path.exists(os.path.join(group['path'], GroupLibFullName(name, Env))):
@ -863,7 +880,7 @@ def GetVersion():
# parse rtdef.h to get RT-Thread version
prepcessor = PatchedPreProcessor()
f = file(rtdef, 'r')
f = open(rtdef, 'r')
contents = f.read()
f.close()
prepcessor.process_contents(contents)

View File

@ -56,7 +56,7 @@ def _CDKProject(tree, target, script):
project_path = os.path.dirname(os.path.abspath(target))
root = tree.getroot()
out = file(target, 'wb')
out = open(target, 'w')
out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
CPPPATH = []
@ -73,28 +73,28 @@ def _CDKProject(tree, target, script):
group_tree = SDKAddGroup(ProjectFiles, root, group['name'], group['src'], project_path)
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
if CPPPATH:
CPPPATH += group['CPPPATH']
else:
CPPPATH += group['CPPPATH']
# get each group's definitions
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
if 'CPPDEFINES' in group and group['CPPDEFINES']:
if CPPDEFINES:
CPPDEFINES += group['CPPDEFINES']
else:
CPPDEFINES += group['CPPDEFINES']
# get each group's cc flags
if group.has_key('CCFLAGS') and group['CCFLAGS']:
if 'CCFLAGS' in group and group['CCFLAGS']:
if CCFLAGS:
CCFLAGS += ' ' + group['CCFLAGS']
else:
CCFLAGS += group['CCFLAGS']
# get each group's link flags
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
if 'LINKFLAGS' in group and group['LINKFLAGS']:
if LINKFLAGS:
LINKFLAGS += ' ' + group['LINKFLAGS']
else:

View File

@ -73,7 +73,7 @@ def CBProject(target, script, program):
root = tree.getroot()
out = file(target, 'wb')
out = open(target, 'w')
out.write('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\n')
ProjectFiles = []
@ -90,7 +90,7 @@ def CBProject(target, script, program):
# SECTION 2.
# write head include path
if building.Env.has_key('CPPPATH'):
if 'CPPPATH' in building.Env:
cpp_path = building.Env['CPPPATH']
paths = set()
for path in cpp_path:
@ -114,7 +114,7 @@ def CBProject(target, script, program):
# write link flags
'''
# write lib dependence
if building.Env.has_key('LIBS'):
if 'LIBS' in building.Env:
for elem in tree.iter(tag='Tool'):
if elem.attrib['Name'] == 'VCLinkerTool':
break
@ -123,7 +123,7 @@ def CBProject(target, script, program):
elem.set('AdditionalDependencies', libs)
# write lib include path
if building.Env.has_key('LIBPATH'):
if 'LIBPATH' in building.Env:
lib_path = building.Env['LIBPATH']
paths = set()
for path in lib_path:

View File

@ -105,26 +105,27 @@ def GCCResult(rtconfig, str):
posix_thread = 0
for line in stdout.split(b'\n'):
if re.search(b'fd_set', line):
line = line.decode()
if re.search('fd_set', line):
have_fdset = 1
# check for sigal
if re.search(b'struct[ \t]+sigaction', line):
if re.search('struct[ \t]+sigaction', line):
have_sigaction = 1
if re.search(b'struct[ \t]+sigevent', line):
if re.search('struct[ \t]+sigevent', line):
have_sigevent = 1
if re.search(b'siginfo_t', line):
if re.search('siginfo_t', line):
have_siginfo = 1
if re.search(b'union[ \t]+sigval', line):
if re.search('union[ \t]+sigval', line):
have_sigval = 1
if re.search(b'char\* version', line):
version = re.search(br'\"([^"]+)\"', line).groups()[0]
if re.search('char\* version', line):
version = re.search(r'\"([^"]+)\"', line).groups()[0]
if re.findall(b'iso_c_visible = [\d]+', line):
if re.findall('iso_c_visible = [\d]+', line):
stdc = re.findall('[\d]+', line)[0]
if re.findall(b'pthread_create', line):
if re.findall('pthread_create', line):
posix_thread = 1
if have_fdset:

View File

@ -6,7 +6,7 @@ def genconfig() :
PreProcessor = SCons.cpp.PreProcessor()
try:
f = file('rtconfig.h', 'r')
f = open('rtconfig.h', 'r')
contents = f.read()
f.close()
except :
@ -16,7 +16,7 @@ def genconfig() :
options = PreProcessor.cpp_namespace
try:
f = file('.config', 'w')
f = open('.config', 'w')
for (opt, value) in options.items():
if type(value) == type(1):
f.write("CONFIG_%s=%d\n" % (opt, value))

View File

@ -25,6 +25,7 @@
import os
import sys
import string
import utils
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement
@ -62,14 +63,14 @@ def IARAddGroup(parent, name, files, project_path):
file_name = SubElement(file, 'name')
if os.path.isabs(path):
file_name.text = path.decode(fs_encoding)
file_name.text = path # path.decode(fs_encoding)
else:
file_name.text = ('$PROJ_DIR$\\' + path).decode(fs_encoding)
file_name.text = '$PROJ_DIR$\\' + path # ('$PROJ_DIR$\\' + path).decode(fs_encoding)
def IARWorkspace(target):
# make an workspace
workspace = target.replace('.ewp', '.eww')
out = file(workspace, 'wb')
out = open(workspace, 'w')
xml = iar_workspace % target
out.write(xml)
out.close()
@ -80,7 +81,7 @@ def IARProject(target, script):
tree = etree.parse('template.ewp')
root = tree.getroot()
out = file(target, 'wb')
out = open(target, 'w')
CPPPATH = []
CPPDEFINES = []
@ -105,18 +106,18 @@ def IARProject(target, script):
IARAddGroup(root, group['name'], group['src'], project_path)
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
CPPPATH += group['CPPPATH']
# get each group's definitions
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
if 'CPPDEFINES' in group and group['CPPDEFINES']:
CPPDEFINES += group['CPPDEFINES']
# get each group's link flags
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
if 'LINKFLAGS' in group and group['LINKFLAGS']:
LINKFLAGS += group['LINKFLAGS']
if group.has_key('LIBS') and group['LIBS']:
if 'LIBS' in group and group['LIBS']:
for item in group['LIBS']:
lib_path = searchLib(group)
if lib_path != '':
@ -161,7 +162,7 @@ def IARProject(target, script):
state.text = path
xml_indent(root)
out.write(etree.tostring(root, encoding='utf-8'))
out.write(etree.tostring(root, encoding='utf-8').decode())
out.close()
IARWorkspace(target)
@ -176,14 +177,14 @@ def IARVersion():
# backup environ
old_environ = os.environ
os.environ['RTT_CC'] = 'iar'
reload(rtconfig)
utils.ReloadModule(rtconfig)
# get iar path
path = rtconfig.EXEC_PATH
# restore environ
os.environ = old_environ
reload(rtconfig)
utils.ReloadModule(rtconfig)
return path

View File

@ -159,12 +159,12 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
if ProjectFiles.count(obj_name):
name = basename + '_' + name
ProjectFiles.append(obj_name)
file_name.text = name.decode(fs_encoding)
file_name.text = name # name.decode(fs_encoding)
file_type = SubElement(file, 'FileType')
file_type.text = '%d' % _get_filetype(name)
file_path = SubElement(file, 'FilePath')
file_path.text = path.decode(fs_encoding)
file_path.text = path # path.decode(fs_encoding)
return group
@ -173,7 +173,7 @@ def MDK45Project(tree, target, script):
project_path = os.path.dirname(os.path.abspath(target))
root = tree.getroot()
out = file(target, 'wb')
out = open(target, 'w')
out.write('<?xml version="1.0" encoding="UTF-8" standalone="no" ?>\n')
CPPPATH = []
@ -191,51 +191,51 @@ def MDK45Project(tree, target, script):
group_tree = MDK4AddGroup(ProjectFiles, groups, group['name'], group['src'], project_path)
# for local CPPPATH/CPPDEFINES
if (group_tree != None) and (group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPDEFINES')):
if (group_tree != None) and ('LOCAL_CPPPATH' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPDEFINES' in group):
GroupOption = SubElement(group_tree, 'GroupOption')
GroupArmAds = SubElement(GroupOption, 'GroupArmAds')
Cads = SubElement(GroupArmAds, 'Cads')
VariousControls = SubElement(Cads, 'VariousControls')
MiscControls = SubElement(VariousControls, 'MiscControls')
if group.has_key('LOCAL_CCFLAGS'):
if 'LOCAL_CCFLAGS' in group:
MiscControls.text = group['LOCAL_CCFLAGS']
else:
MiscControls.text = ' '
Define = SubElement(VariousControls, 'Define')
if group.has_key('LOCAL_CPPDEFINES'):
if 'LOCAL_CPPDEFINES' in group:
Define.text = ', '.join(set(group['LOCAL_CPPDEFINES']))
else:
Define.text = ' '
Undefine = SubElement(VariousControls, 'Undefine')
Undefine.text = ' '
IncludePath = SubElement(VariousControls, 'IncludePath')
if group.has_key('LOCAL_CPPPATH'):
if 'LOCAL_CPPPATH' in group:
IncludePath.text = ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in group['LOCAL_CPPPATH']])
else:
IncludePath.text = ' '
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
if CPPPATH:
CPPPATH += group['CPPPATH']
else:
CPPPATH += group['CPPPATH']
# get each group's definitions
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
if 'CPPDEFINES' in group and group['CPPDEFINES']:
if CPPDEFINES:
CPPDEFINES += group['CPPDEFINES']
else:
CPPDEFINES = group['CPPDEFINES']
# get each group's link flags
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
if 'LINKFLAGS' in group and group['LINKFLAGS']:
if LINKFLAGS:
LINKFLAGS += ' ' + group['LINKFLAGS']
else:
LINKFLAGS += group['LINKFLAGS']
if group.has_key('LIBS') and group['LIBS']:
if 'LIBS' in group and group['LIBS']:
for item in group['LIBS']:
lib_path = ''
for path_item in group['LIBPATH']:
@ -260,7 +260,7 @@ def MDK45Project(tree, target, script):
Misc.text = LINKFLAGS
xml_indent(root)
out.write(etree.tostring(root, encoding='utf-8'))
out.write(etree.tostring(root, encoding='utf-8').decode())
out.close()
def MDK4Project(target, script):
@ -294,10 +294,10 @@ def MDK5Project(target, script):
shutil.copy2('template.uvoptx', 'project.uvoptx')
def MDKProject(target, script):
template = file('template.Uv2', "rb")
template = open('template.Uv2', "r")
lines = template.readlines()
project = file(target, "wb")
project = open(target, "w")
project_path = os.path.dirname(os.path.abspath(target))
line_index = 5
@ -323,21 +323,21 @@ def MDKProject(target, script):
# print group['name']
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
if CPPPATH:
CPPPATH += group['CPPPATH']
else:
CPPPATH += group['CPPPATH']
# get each group's definitions
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
if 'CPPDEFINES' in group and group['CPPDEFINES']:
if CPPDEFINES:
CPPDEFINES += group['CPPDEFINES']
else:
CPPDEFINES = group['CPPDEFINES']
# get each group's link flags
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
if 'LINKFLAGS' in group and group['LINKFLAGS']:
if LINKFLAGS:
LINKFLAGS += ' ' + group['LINKFLAGS']
else:

View File

@ -30,12 +30,12 @@ import shutil
def mk_rtconfig(filename):
try:
config = file(filename)
config = open(filename, 'r')
except:
print('open config:%s failed' % filename)
return
rtconfig = file('rtconfig.h', 'wb')
rtconfig = open('rtconfig.h', 'w')
rtconfig.write('#ifndef RT_CONFIG_H__\n')
rtconfig.write('#define RT_CONFIG_H__\n\n')
@ -131,7 +131,7 @@ def touch_env():
os.mkdir(os.path.join(env_dir, 'local_pkgs'))
os.mkdir(os.path.join(env_dir, 'packages'))
os.mkdir(os.path.join(env_dir, 'tools'))
kconfig = file(os.path.join(env_dir, 'packages', 'Kconfig'), 'wb')
kconfig = open(os.path.join(env_dir, 'packages', 'Kconfig'), 'w')
kconfig.close()
if not os.path.exists(os.path.join(env_dir, 'packages', 'packages')):
@ -150,7 +150,7 @@ def touch_env():
"********************************************************************************\n")
help_info()
else:
kconfig = file(os.path.join(env_dir, 'packages', 'Kconfig'), 'wb')
kconfig = open(os.path.join(env_dir, 'packages', 'Kconfig'), 'w')
kconfig.write('source "$PKGS_DIR/packages/Kconfig"')
kconfig.close()
except:
@ -189,7 +189,7 @@ def touch_env():
help_info()
if sys.platform != 'win32':
env_sh = file(os.path.join(env_dir, 'env.sh'), 'w')
env_sh = open(os.path.join(env_dir, 'env.sh'), 'w')
env_sh.write('export PATH=~/.env/tools/scripts:$PATH')
else:
if os.path.exists(os.path.join(env_dir, 'tools', 'scripts')):

View File

@ -28,7 +28,7 @@ from building import *
def ExtendPackageVar(package, var):
v = []
if not package.has_key(var):
if var not in package:
return v
for item in package[var]:
@ -38,7 +38,7 @@ def ExtendPackageVar(package, var):
def BuildPackage(package):
import json
f = file(package)
f = open(package)
package_json = f.read()
# get package.json path
@ -47,20 +47,20 @@ def BuildPackage(package):
package = json.loads(package_json)
# check package name
if not package.has_key('name'):
if 'name' not in package:
return []
# get depends
depend = ExtendPackageVar(package, 'depends')
src = []
if package.has_key('source_files'):
if 'source_files' in package:
for src_file in package['source_files']:
src_file = os.path.join(cwd, src_file)
src += Glob(src_file)
CPPPATH = []
if package.has_key('CPPPATH'):
if 'CPPPATH' in package:
for path in package['CPPPATH']:
if path.startswith('/') and os.path.isdir(path):
CPPPATH = CPPPATH + [path]

View File

@ -198,7 +198,7 @@ class SconsUI():
setting_path = os.path.join(home, '.rtt_scons')
if os.path.exists(setting_path):
setting = file(os.path.join(home, '.rtt_scons'))
setting = open(os.path.join(home, '.rtt_scons'))
for line in setting:
line = line.replace('\n', '')
line = line.replace('\r', '')
@ -215,7 +215,7 @@ class SconsUI():
setting.close()
# set RT-Thread Root Directory according environ
if os.environ.has_key('RTT_ROOT'):
if 'RTT_ROOT' in os.environ:
self.RTTRoot.set_path(os.environ['RTT_ROOT'])
if self.RTTRoot.get_path() == '':
@ -268,7 +268,7 @@ class SconsUI():
else:
home = os.environ['HOME']
setting = file(os.path.join(home, '.rtt_scons'), 'wb+')
setting = open(os.path.join(home, '.rtt_scons'), 'w+')
# current comiler
# line = '%s=%s\n' % ('compiler', self.compilers.get()))
line = '%s=%s\n' % ('compiler', 'iar')

View File

@ -52,11 +52,11 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
for group in project:
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
CPPPATH += group['CPPPATH']
# get each group's definitions
if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
if 'CPPDEFINES' in group and group['CPPDEFINES']:
CPPDEFINES += group['CPPDEFINES']
if len(CPPPATH):

View File

@ -183,14 +183,14 @@ def ProjectInfo(env):
for group in project:
# get each files
if group.has_key('src') and group['src']:
if 'src' in group and group['src']:
FILES += group['src']
# get each include path
if group.has_key('CPPPATH') and group['CPPPATH']:
if 'CPPPATH' in group and group['CPPPATH']:
CPPPATH += group['CPPPATH']
if env.has_key('CPPDEFINES'):
if 'CPPDEFINES' in env:
CPPDEFINES = env['CPPDEFINES']
CPPDEFINES = ListMap(CPPDEFINES)
@ -243,3 +243,47 @@ def ProjectInfo(env):
proj['CPPDEFINES'] = CPPDEFINES
return proj
def VersionCmp(ver1, ver2):
la = ver1.split('.')
lb = ver2.split('.')
f = 0
if len(la) > len(lb):
f = len(la)
else:
f = len(lb)
for i in range(f):
try:
if int(la[i]) > int(lb[i]):
return 1
elif int(la[i]) == int(lb[i]):
continue
else:
return -1
except IndexError as e:
if len(la) > len(lb):
return 1
else:
return -1
return 0
def GCCC99Patch(cflags):
import building
gcc_version = building.GetDepend('GCC_VERSION')
if gcc_version:
gcc_version = gcc_version.replace('"', '')
if VersionCmp(gcc_version, "4.8.0"):
# remove -std=c99 after GCC 4.8.x
cflags = cflags.replace('-std=c99', '')
return cflags
def ReloadModule(module):
import sys
if sys.version_info.major >= 3:
import importlib
importlib.reload(module)
else:
reload(module)
return

View File

@ -78,7 +78,7 @@ def VSProject(target, script, program):
tree = etree.parse('template_vs2005.vcproj')
root = tree.getroot()
out = file(target, 'wb')
out = open(target, 'w')
out.write('<?xml version="1.0" encoding="UTF-8"?>\r\n')
ProjectFiles = []
@ -91,7 +91,7 @@ def VSProject(target, script, program):
for group in script:
libs = []
if group.has_key('LIBS') and group['LIBS']:
if 'LIBS' in group and group['LIBS']:
for item in group['LIBS']:
lib_path = ''
for path_item in group['LIBPATH']:
@ -111,7 +111,7 @@ def VSProject(target, script, program):
VS_AddHeadFilesGroup(program, elem, project_path)
# write head include path
if building.Env.has_key('CPPPATH'):
if 'CPPPATH' in building.Env:
cpp_path = building.Env['CPPPATH']
paths = set()
for path in cpp_path:
@ -130,7 +130,7 @@ def VSProject(target, script, program):
elem.set('AdditionalIncludeDirectories', cpp_path)
# write cppdefinitons flags
if building.Env.has_key('CPPDEFINES'):
if 'CPPDEFINES' in building.Env:
CPPDEFINES = building.Env['CPPDEFINES']
definitions = []
if type(CPPDEFINES[0]) == type(()):
@ -143,7 +143,7 @@ def VSProject(target, script, program):
# write link flags
# write lib dependence
if building.Env.has_key('LIBS'):
if 'LIBS' in building.Env:
for elem in tree.iter(tag='Tool'):
if elem.attrib['Name'] == 'VCLinkerTool':
break
@ -152,7 +152,7 @@ def VSProject(target, script, program):
elem.set('AdditionalDependencies', libs)
# write lib include path
if building.Env.has_key('LIBPATH'):
if 'LIBPATH' in building.Env:
lib_path = building.Env['LIBPATH']
paths = set()
for path in lib_path:

View File

@ -168,7 +168,7 @@ def VS2012Project(target, script, program):
VS_add_HeadFiles(program, elem, project_path)
# write head include path
if building.Env.has_key('CPPPATH'):
if 'CPPPATH' in building.Env:
cpp_path = building.Env['CPPPATH']
paths = set()
for path in cpp_path:
@ -185,7 +185,7 @@ def VS2012Project(target, script, program):
break
# write cppdefinitons flags
if building.Env.has_key('CPPDEFINES'):
if 'CPPDEFINES' in building.Env:
for elem in tree.iter(tag='PreprocessorDefinitions'):
definitions = ';'.join(building.Env['CPPDEFINES']) + ';%(PreprocessorDefinitions)'
elem.text = definitions
@ -193,7 +193,7 @@ def VS2012Project(target, script, program):
# write link flags
# write lib dependence (Link)
if building.Env.has_key('LIBS'):
if 'LIBS' in building.Env:
for elem in tree.iter(tag='AdditionalDependencies'):
libs_with_extention = [i+'.lib' for i in building.Env['LIBS']]
libs = ';'.join(libs_with_extention) + ';%(AdditionalDependencies)'
@ -201,7 +201,7 @@ def VS2012Project(target, script, program):
break
# write lib include path
if building.Env.has_key('LIBPATH'):
if 'LIBPATH' in building.Env:
lib_path = building.Env['LIBPATH']
paths = set()
for path in lib_path:

View File

@ -66,19 +66,19 @@ Return('objs')
'''
def usage():
print 'wizard --component name'
print 'wizard --bridge'
print('wizard --component name')
print('wizard --bridge')
def gen_component(name):
print 'generate SConscript for ' + name
print('generate SConscript for ' + name)
text = SConscript_com.replace('COMPONENT_NAME', name)
f = file('SConscript', 'w')
f = open('SConscript', 'w')
f.write(text)
f.close()
def gen_bridge():
print 'generate SConscript for bridge'
f = file('SConscript', 'w')
print('generate SConscript for bridge')
f = open('SConscript', 'w')
f.write(SConscript_bridge)
f.close()