Use plugin_path to improve path logic...

Added in Galaxy commit https://bitbucket.org/galaxy/galaxy-central/commits/ddc9a669d53aa259d38efc882c890503444daaf5. Added it to Galaxy cleanup the code and this is the result - oh well :) - it is at least more techically correct.
This commit is contained in:
John Chilton
2014-10-18 18:38:04 -04:00
parent b4d641b013
commit 2cd37cc658
@@ -25,14 +25,23 @@ try:
except:
galaxy_paster_port = None
viz_plugin_dir = None
try:
# Newer Python versions allow more, direct/correct
# access to the current plugin directory.
viz_plugin_dir = plugin_path
except Exception:
pass
if not viz_plugin_dir:
# Provide fallback for older versions.
viz_plugin_dir = config.get('app:main', 'visualization_plugins_directory')
if not os.path.isabs(viz_plugin_dir):
# If it is NOT absolute, i.e. relative, append to galaxy root
viz_plugin_dir = os.path.join(galaxy_root_dir, viz_plugin_dir)
# Get this plugin's directory
viz_plugin_dir = os.path.join(viz_plugin_dir, "ipython")
# Find out where we are
viz_plugin_dir = config.get('app:main', 'visualization_plugins_directory')
if not os.path.isabs(viz_plugin_dir):
# If it is NOT absolute, i.e. relative, append to galaxy root
viz_plugin_dir = os.path.join(galaxy_root_dir, viz_plugin_dir)
# Get this plugin's directory
viz_plugin_dir = os.path.join(viz_plugin_dir, "ipython")
# Store our template and configuration path
our_config_dir = os.path.join(viz_plugin_dir, "config")
our_template_dir = os.path.join(viz_plugin_dir, "templates")