[Launcher] Make lib dir's files writeable before updating

Should fix #569
This commit is contained in:
Twentysix 2017-01-10 19:19:02 +01:00
parent e034615005
commit dfd0235e78

View File

@ -65,6 +65,7 @@ def parse_cli_arguments():
def install_reqs(audio):
remove_reqs_readonly()
interpreter = sys.executable
if interpreter is None:
@ -116,6 +117,7 @@ def update_pip():
def update_red():
remove_reqs_readonly()
try:
code = subprocess.call(("git", "pull", "--ff-only"))
except FileNotFoundError:
@ -421,6 +423,18 @@ def remove_readonly(func, path, excinfo):
func(path)
def remove_reqs_readonly():
"""Workaround for issue #569"""
if not os.path.isdir(REQS_DIR):
return
os.chmod(REQS_DIR, stat.S_IWRITE)
for root, dirs, files in os.walk(REQS_DIR):
for d in dirs:
os.chmod(os.path.join(root, d), stat.S_IWRITE)
for f in files:
os.chmod(os.path.join(root, f), stat.S_IWRITE)
def calculate_md5(filename):
hash_md5 = hashlib.md5()
with open(filename, "rb") as f: