commit/galaxy-central: natefoo: Place the new egg config options into the environment at Galaxy startup since
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/45072dc79c5c/ Changeset: 45072dc79c5c User: natefoo Date: 2015-02-12 19:27:37+00:00 Summary: Place the new egg config options into the environment at Galaxy startup since eggs.require() has no access to the config file. Affected #: 1 file diff -r c981094a4d50f40e4dae3f0fd49089b46a0e2897 -r 45072dc79c5c8a5d6f1bbc9883e25bb3cb8b6319 scripts/paster.py --- a/scripts/paster.py +++ b/scripts/paster.py @@ -7,6 +7,11 @@ import os, sys +try: + import configparser +except: + import ConfigParser as configparser + # ensure supported version from check_python import check_python try: @@ -19,15 +24,44 @@ sys.path = new_path from galaxy import eggs -import pkg_resources if 'LOG_TEMPFILES' in os.environ: from log_tempfile import TempFile _log_tempfile = TempFile() import tempfile -pkg_resources.require( "Paste" ) -pkg_resources.require( "PasteDeploy" ) +try: + serve = sys.argv.index('serve') +except: + print >>sys.stderr, "Galaxy does not use the real Paste Script, the only supported command is 'serve'" + sys.exit(1) + +# eggs.require() can be called inside the app without access to the Galaxy +# config, so we need to push the egg options into the environment so they are +# available to Crate instantiated in require() + +# locate the arg containing the path to the config file +config = None +p = configparser.ConfigParser() +for arg in sys.argv: + try: + p.read(arg) + assert 'app:main' in p.sections() + config = arg + break + except (configparser.Error, AssertionError): + pass + +# find any egg options set in the config +crate = eggs.Crate(config) +for opt in ('enable_eggs', 'enable_egg_fetch', 'try_dependencies_from_env'): + env = 'GALAXY_CONFIG_' + opt.upper() + # don't overwrite existing env vars configured by the user + if env not in os.environ: + os.environ[env] = str(getattr(crate.galaxy_config, opt)) + +eggs.require( "Paste" ) +eggs.require( "PasteDeploy" ) from galaxy.util.pastescript import serve serve.run() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org