Commit 35754dc4 authored by Nicola Soranzo's avatar Nicola Soranzo
Browse files

Fix symlinking during plugin staging

Remove also broken symlinks before creating the new ones.
parent 7f38e61c
from __future__ import print_function
import glob
import os
import shutil
......@@ -9,16 +11,20 @@ def link_up_static(f):
src = os.path.join(GXY_ROOT, 'config/plugins', f)
dest = os.path.join(GXY_ROOT, 'static/plugins', f)
dest_parent = os.path.abspath(os.path.join(dest, os.pardir))
if os.path.exists(dest):
if os.path.lexists(dest):
# We have to clear out the old staged or linked static to relink.
if os.path.islink(dest):
os.unlink(dest)
os.remove(dest)
else:
shutil.rmtree(dest)
elif not os.path.exists(dest_parent):
# Create parent dir structure to symlink directly to static.
os.makedirs(dest_parent)
os.symlink(src, dest)
try:
os.symlink(src, dest)
except Exception:
print("Error symlinking '%s' to '%s'" % (src, dest))
raise
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment