Fix config schema packaging

This commit is contained in:
mvdbeek
2022-01-19 18:20:16 +00:00
committed by Nicola Soranzo
parent d3cfb72266
commit 03e218df68
14 changed files with 22 additions and 21 deletions
+5 -4
View File
@@ -63,9 +63,9 @@ from galaxy.web_stack import get_stack_facts
from ..version import VERSION_MAJOR, VERSION_MINOR
try:
from importlib.resources import files
from importlib.resources import files # type: ignore[attr-defined]
except ImportError:
from importlib_resources import files
from importlib_resources import files # type: ignore[no-redef]
if TYPE_CHECKING:
from galaxy.jobs import JobConfiguration
@@ -77,7 +77,9 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__)
GALAXY_APP_NAME = 'galaxy'
GALAXY_CONFIG_SCHEMA_PATH = files('galaxy.webapps.galaxy') / 'config_schema.yml'
GALAXY_SCHEMAS_PATH = files('galaxy.config') / 'schemas'
GALAXY_CONFIG_SCHEMA_PATH = GALAXY_SCHEMAS_PATH / 'config_schema.yml'
UWSGI_SCHEMA_PATH = GALAXY_SCHEMAS_PATH / 'uwsgi_schema.yml'
LOGGING_CONFIG_DEFAULT: Dict[str, Any] = {
'disable_existing_loggers': False,
'version': 1,
@@ -628,7 +630,6 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):
self._process_config(kwargs)
def _load_schema(self):
# Schemas are symlinked to the root of the galaxy-app package
return AppSchema(GALAXY_CONFIG_SCHEMA_PATH, GALAXY_APP_NAME)
def _override_tempdir(self, kwargs):
+6 -5
View File
@@ -22,7 +22,10 @@ if __name__ == '__main__':
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)))
from galaxy.config import GALAXY_CONFIG_SCHEMA_PATH
from galaxy.config import (
GALAXY_CONFIG_SCHEMA_PATH,
UWSGI_SCHEMA_PATH,
)
from galaxy.config.schema import (
AppSchema,
OPTION_DEFAULTS,
@@ -48,7 +51,6 @@ UNHANDLED_FILTER_TYPE_MESSAGE = "Unhandled filter type encountered [%s] for sect
NO_APP_MAIN_MESSAGE = "No app:main section found, using application defaults throughout."
YAML_COMMENT_WRAPPER = TextWrapper(initial_indent="# ", subsequent_indent="# ", break_long_words=False, break_on_hyphens=False)
RST_DESCRIPTION_WRAPPER = TextWrapper(initial_indent=" ", subsequent_indent=" ", break_long_words=False, break_on_hyphens=False)
UWSGI_SCHEMA_PATH = "lib/galaxy/webapps/uwsgi_schema.yml"
UWSGI_OPTIONS = dict([
('http', {
@@ -346,7 +348,7 @@ GALAXY_APP = App(
"8080",
["galaxy.web.buildapp:app_factory"], # TODO: Galaxy could call factory a few different things and they'd all be fine.
"config/galaxy.yml",
GALAXY_CONFIG_SCHEMA_PATH,
str(GALAXY_CONFIG_SCHEMA_PATH),
'galaxy.webapps.galaxy.buildapp:uwsgi_app()',
)
SHED_APP = App(
@@ -465,9 +467,8 @@ def _build_uwsgi_schema(args, app_desc):
"desc": "uwsgi definition, see https://uwsgi-docs.readthedocs.io/en/latest/Options.html",
"mapping": options
}
path = os.path.join(args.galaxy_root, UWSGI_SCHEMA_PATH)
contents = ordered_dump(schema)
_write_to_file(args, contents, path)
_write_to_file(args, contents, UWSGI_SCHEMA_PATH)
def _find_config(args, app_desc):
+1
View File
@@ -0,0 +1 @@
../../../../lib/galaxy/webapps/uwsgi_schema.yml
+2 -2
View File
@@ -42,9 +42,9 @@ from galaxy.web.framework import (
from galaxy.web_stack import get_app_kwds
try:
from importlib.resources import files
from importlib.resources import files # type: ignore[attr-defined]
except ImportError:
from importlib_resources import files
from importlib_resources import files # type: ignore[no-redef]
log = logging.getLogger(__name__)
@@ -1 +0,0 @@
../uwsgi_schema.yml
+1 -1
View File
@@ -1,5 +1,5 @@
include *.rst *.txt LICENSE
include galaxy/*.yml
include galaxy/config/*.yml
include galaxy/config/sample/*.sample*
include galaxy/jobs/runners/util/job_script/*.sh
include galaxy/tools/*tsv
-1
View File
@@ -1 +0,0 @@
../../../lib/galaxy/webapps/galaxy/config_schema.yml
@@ -1 +0,0 @@
../../../lib/galaxy/webapps/galaxy/job_config_schema.yml
-1
View File
@@ -1 +0,0 @@
../../../lib/galaxy/webapps/galaxy/uwsgi_schema.yml
+3 -3
View File
@@ -101,9 +101,9 @@ ENTRY_POINTS = '''
PACKAGE_DATA = {
# Be sure to update MANIFEST.in for source dist.
'galaxy': [
'config_schema.yml',
'job_config_schema.yml',
'uwsgi_schema.yml',
'config/schemas/config_schema.yml',
'config/schemas/job_config_schema.yml',
'config/schemas/uwsgi_schema.yml',
'config/sample/*',
],
'tool_shed': [
+1
View File
@@ -40,6 +40,7 @@ future = "*"
galaxy_sequence_utils = "*"
gxformat2 = "*"
h5py = "*"
importlib_resources = "*"
isa-rwval = "*"
kombu = "*"
lagom = "*"
+3 -2
View File
@@ -7,6 +7,7 @@ from unittest import mock
from pykwalify.core import Core
from galaxy.config import GALAXY_SCHEMAS_PATH
from galaxy.job_metrics import JobMetrics
from galaxy.jobs import JobConfiguration
from galaxy.util import galaxy_directory, galaxy_samples_directory
@@ -422,7 +423,7 @@ class AdvancedJobConfYamlParserTestCase(AdvancedJobConfXmlParserTestCase):
def test_yaml_advanced_validation():
schema = os.path.join(galaxy_directory(), "lib", "galaxy", "webapps", "galaxy", "job_config_schema.yml")
schema = GALAXY_SCHEMAS_PATH / 'job_config_schema.yml'
integration_tests_dir = os.path.join(galaxy_directory(), "test", "integration")
valid_files = [
ADVANCED_JOB_CONF_YAML,
@@ -435,6 +436,6 @@ def test_yaml_advanced_validation():
for valid_file in valid_files:
c = Core(
source_file=valid_file,
schema_files=[schema],
schema_files=[str(schema)],
)
c.validate()