[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
+5 -5
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]