Skip to content

Instantly share code, notes, and snippets.

@squeedee
Last active February 14, 2018 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squeedee/d751187994a53b1796b54a1ab1ef7943 to your computer and use it in GitHub Desktop.
Save squeedee/d751187994a53b1796b54a1ab1ef7943 to your computer and use it in GitHub Desktop.
Md5 things in python
def execute_build():
os.chdir("./dashboard2")
subprocess.call(["npm", "run", "build"])
os.chdir("../")
def save_srcs_md5(md5, path):
file = open(path, "w")
file.write(md5)
file.close()
def get_old_md5(path):
old_md5 = None
if os.path.isfile(path):
md5_file = open(path, "r")
old_md5 = md5_file.readline()
md5_file.close()
return old_md5
def create_srcs_md5():
md5 = subprocess.check_output(
"find ./dashboard2 -not -path '*/\.*' -type f | grep -v dashboard2/build | grep -v node_modules | xargs md5 | md5",
shell=True)
return md5
def create_temp_dir(file_dir):
try:
os.makedirs(file_dir)
except OSError as e:
if e.errno != errno.EEXIST:
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment