mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Launcher] Make lib dir's files writeable before updating
Should fix #569
This commit is contained in:
parent
e034615005
commit
dfd0235e78
14
launcher.py
14
launcher.py
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user