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