代码拉取完成,页面将自动刷新
import platform
import shutil
import os
import sys
import subprocess
version = "1.0-beta.2"
packages = ["s", "files", "sockets", "testtube", "json"]
source = os.path.dirname(os.path.realpath(__file__))
dist_name = "Emojicode-{0}-{1}-{2}".format(version, platform.system(),
platform.machine())
path = os.path.abspath(dist_name)
def copy_packages(destination, source):
for package in packages:
dir_path = os.path.join(destination, package)
make_dir(dir_path)
shutil.copy2(os.path.join(package.encode('utf-8'), "🏛".encode('utf-8')), dir_path.encode('utf-8'))
shutil.copy2(os.path.join(package, "lib" + package + ".a"), dir_path)
def make_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def copy_header(*args):
make_dir(os.path.join(path, "include", *args[:-1]))
shutil.copy2(os.path.join(source, *args),
os.path.join(path, "include", *args))
if __name__ == "__main__":
make_dir(path)
shutil.copy2(os.path.join(source, "install.sh"), path)
shutil.copy2(os.path.join("Compiler", "emojicodec"), path)
copy_header("runtime", "Runtime.h")
copy_header("s", "Data.h")
copy_header("s", "String.h")
dir_path = os.path.join(path, "packages", "runtime")
make_dir(dir_path)
shutil.copy2(os.path.join("runtime", "libruntime.a"), dir_path)
copy_packages(os.path.join(path, "packages"),
os.path.join(source, "headers"))
if len(sys.argv) > 1 and sys.argv[1] == "archive":
archive_name = shutil.make_archive(dist_name, "gztar", os.getcwd(), dist_name)
print(archive_name, end='')
if len(sys.argv) > 1 and sys.argv[1] == "install":
bash = "cd " + path + " && yes | " + os.path.join(path, "install.sh")
subprocess.run(["bash", "-c", bash])
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。