pikapython/SConscript

67 lines
1.7 KiB
Python
Raw Permalink Normal View History

2021-10-03 21:10:19 -04:00
# RT-Thread building script for bridge
2021-12-06 10:49:05 +08:00
import os, shutil
2021-12-07 00:42:34 +08:00
import subprocess
2021-10-03 21:10:19 -04:00
from building import *
2021-12-06 10:49:05 +08:00
def pikascript_init():
2021-12-06 23:06:23 +08:00
cwd = GetCurrentDir()
2021-12-06 10:49:05 +08:00
def mycopyfile(srcfile,dstfile):
if not os.path.isfile(srcfile):
pass
else:
fpath,fname=os.path.split(dstfile)
if not os.path.exists(fpath):
os.makedirs(fpath)
shutil.copyfile(srcfile,dstfile)
mycopyfile(cwd + '/port/rt-thread/main.py', cwd + '/main.py')
mycopyfile(cwd + '/port/rt-thread/pikaPackage.exe', cwd + '/pikaPackage.exe')
mycopyfile(cwd + '/port/rt-thread/requestment.txt', cwd + '/requestment.txt')
def myremove(path):
2021-12-07 00:31:57 +08:00
all_path = cwd + '\\' + path
2021-12-07 00:42:34 +08:00
os.popen('del ' + all_path + ' /F /Q /S')
os.popen('rd ' + all_path + ' /Q /S')
2021-12-06 10:49:05 +08:00
myremove('assets')
myremove('docker')
2021-12-06 21:04:12 -05:00
myremove('bsp')
myremove('document')
myremove('examples')
myremove('package')
myremove('port')
myremove('src')
myremove('test')
2021-12-06 21:04:12 -05:00
myremove('tools')
myremove('.github')
myremove('.git')
myremove('.vscode')
myremove('.gitattributes')
myremove('.gitignore')
myremove('logo.txt')
myremove('packages.toml')
2021-12-06 10:49:05 +08:00
os.system(cwd + '/' + 'pikaPackage.exe')
os.system(cwd + '/' + 'rust-msc-latest-win10.exe')
# init pikascript
pikascript_init()
# init argument
cwd = GetCurrentDir()
group = []
src = []
inc = []
# add file and path
for root, dirs, files in os.walk(cwd):
for dir in dirs:
print(dir)
src = Glob(os.path.join(root,dir,'*.c'))
inc = [os.path.join(root,dir)]
2023-05-15 16:21:55 +08:00
group += DefineGroup(dir, src, depend = ['PKG_USING_PIKASCRIPT'], CPPPATH = inc)
2021-12-06 10:49:05 +08:00
Return('group')