mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-20 17:44:20 +08:00
[Tools] Change building script for Py3
This commit is contained in:
+5
-5
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user