12345678910111213141516171819202122232425262728293031 |
- import subprocess
- import os
- import sys
- import shutil
-
- if __name__ == '__main__':
-
- if os.path.exists("src/Dockerfile"):
- os.remove("src/Dockerfile")
- if os.path.exists("src/DockerfileEncrypt"):
- os.remove("src/DockerfileEncrypt")
-
- for root,dir,files in os.walk("./src"):
- for f in files:
- if f.endswith(".py") and f != "main.py":
- shell = f"cd {root} \
- && easycython {f}"
- cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True,
- stdout=sys.stdout, universal_newlines=True, shell=True, bufsize=1)
- cmd.communicate()
- if cmd.returncode != 0:
- raise Exception(f+"加密出错")
- os.remove(os.path.join(root,f))
- os.remove(os.path.join(root,f.split(".")[0]+".html"))
- os.remove(os.path.join(root,f.split(".")[0]+".c"))
- shutil.rmtree(os.path.join(root,"build"))
- os.remove("encrypt.py")
-
-
-
|