Various fixes to plugin assetlinking command.
Actually trying to run the command helps figure out what needs to be fixed :) This commit sponsored by Justin Nichol. Thank you!
This commit is contained in:
parent
491029bc36
commit
df69695d9e
@ -97,7 +97,7 @@ def link_plugin_assets(plugin_static, plugins_link_dir, printer=simple_printer):
|
|||||||
# link_dir is the final directory we'll link to, a combination of
|
# link_dir is the final directory we'll link to, a combination of
|
||||||
# the plugin assetlink directory and plugin_static.name
|
# the plugin assetlink directory and plugin_static.name
|
||||||
link_dir = os.path.sep.join(
|
link_dir = os.path.sep.join(
|
||||||
plugins_link_dir.rstrip(os.path.sep), plugin_static.name)
|
[plugins_link_dir.rstrip(os.path.sep), plugin_static.name])
|
||||||
|
|
||||||
# make the link directory parent dirs if necessary
|
# make the link directory parent dirs if necessary
|
||||||
if not os.path.lexists(plugins_link_dir):
|
if not os.path.lexists(plugins_link_dir):
|
||||||
@ -107,19 +107,19 @@ def link_plugin_assets(plugin_static, plugins_link_dir, printer=simple_printer):
|
|||||||
if os.path.lexists(link_dir):
|
if os.path.lexists(link_dir):
|
||||||
# if this isn't a symlink, there's something wrong... error out.
|
# if this isn't a symlink, there's something wrong... error out.
|
||||||
if not os.path.islink(link_dir):
|
if not os.path.islink(link_dir):
|
||||||
printer(_('Could not link "%s": %s exists and is not a symlink') % (
|
printer(_('Could not link "%s": %s exists and is not a symlink\n') % (
|
||||||
link_dir))
|
plugin_static.name, link_dir))
|
||||||
return
|
return
|
||||||
|
|
||||||
# if this is a symlink and the path already exists, skip it.
|
# if this is a symlink and the path already exists, skip it.
|
||||||
if os.path.realpath(link_dir) == plugin_static.file_path:
|
if os.path.realpath(link_dir) == plugin_static.file_path:
|
||||||
# Is this comment helpful or not?
|
# Is this comment helpful or not?
|
||||||
printer(_('Skipping "%s"; already set up.') % (
|
printer(_('Skipping "%s"; already set up.\n') % (
|
||||||
plugin_static.name))
|
plugin_static.name))
|
||||||
return
|
return
|
||||||
|
|
||||||
# Otherwise, it's a link that went to something else... unlink it
|
# Otherwise, it's a link that went to something else... unlink it
|
||||||
printer(_('Old link found for "%s"; removing.') % (
|
printer(_('Old link found for "%s"; removing.\n') % (
|
||||||
plugin_static.name))
|
plugin_static.name))
|
||||||
os.unlink(link_dir)
|
os.unlink(link_dir)
|
||||||
|
|
||||||
|
@ -119,9 +119,9 @@ def get_staticdirector(app_config):
|
|||||||
|
|
||||||
# Let plugins load additional paths
|
# Let plugins load additional paths
|
||||||
for plugin_static in hook_runall("static_setup"):
|
for plugin_static in hook_runall("static_setup"):
|
||||||
direct_domains[plugin_static['name']] = "%s/%s" % (
|
direct_domains[plugin_static.name] = "%s/%s" % (
|
||||||
app_config['plugin_web_path'].rstrip('/'),
|
app_config['plugin_web_path'].rstrip('/'),
|
||||||
plugin_static['name'])
|
plugin_static.name)
|
||||||
|
|
||||||
return staticdirect.StaticDirect(
|
return staticdirect.StaticDirect(
|
||||||
direct_domains)
|
direct_domains)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user