Last active
February 14, 2018 15:40
-
-
Save squeedee/d751187994a53b1796b54a1ab1ef7943 to your computer and use it in GitHub Desktop.
Md5 things in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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