代码拉取完成,页面将自动刷新
同步操作将从 xupingmao/minipy 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# encoding=utf-8
import sys
import os
sys.path.append("src/python")
import mp_encode
def compile_and_save(fpath, target):
print("compile %s to %s" % (fpath, target))
c = mp_encode.Compiler()
code = c.compile_to_c_code(fpath)
fp = open(target, "w+")
fp.write(code)
fp.close()
def do_build_core():
names = ["mp_init", "mp_tokenize", "mp_parse", "mp_encode", "mp_opcode", "pyeval", "repl"]
for name in names:
source = "./src/python/%s.py" % name
target = "./src/gen/%s.gen.c" % name
compile_and_save(source, target)
def do_build():
print("current path: %s" % os.getcwd())
print("python interpreter: %s" % sys.executable)
do_build_core()
print("compile python files done!")
os.system("make clean && make")
def do_build_user():
names = ["main"]
for name in names:
source = "./pack/%s.py" % name
target = "./pack/%s.gen.c" % name
compile_and_save(source, target)
def build_pack():
print("current path: %s" % os.getcwd())
print("python interpreter: %s" % sys.executable)
do_build_core()
do_build_user()
print("compile python files done!")
os.system("make pack")
def main():
arg1 = ""
if len(sys.argv) >= 2:
arg1 = sys.argv[1]
if arg1 == "pack":
build_pack()
return
do_build()
if __name__ == "__main__":
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。