From b805fa5945e1f6799e6cf28097155e7b1d434b4e Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Mon, 13 Nov 2017 11:55:35 -0500 Subject: [PATCH] Undo changes unrelated to uWSGI mule work --- lib/galaxy/objectstore/__init__.py | 2 +- lib/galaxy/objectstore/azure_blob.py | 3 +-- lib/galaxy/objectstore/pithos.py | 2 +- lib/galaxy/objectstore/rods.py | 2 +- lib/galaxy/objectstore/s3.py | 2 +- lib/galaxy/tools/toolbox/base.py | 7 +++---- lib/galaxy/util/__init__.py | 14 +++++--------- lib/tool_shed/capsule/capsule_manager.py | 3 +-- 8 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lib/galaxy/objectstore/__init__.py b/lib/galaxy/objectstore/__init__.py index ca15d7cbc53..f2cef3073e2 100644 --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -23,10 +23,10 @@ from galaxy.util import ( directory_hash_id, force_symlink, safe_makedirs, + safe_relpath, umask_fix_perms, ) from galaxy.util.odict import odict -from galaxy.util.path import safe_relpath from galaxy.util.sleeper import Sleeper NO_SESSION_ERROR_MESSAGE = "Attempted to 'create' object store entity in configuration with no database session present." diff --git a/lib/galaxy/objectstore/azure_blob.py b/lib/galaxy/objectstore/azure_blob.py index 02f08b6efbe..c3e12a7bd89 100644 --- a/lib/galaxy/objectstore/azure_blob.py +++ b/lib/galaxy/objectstore/azure_blob.py @@ -11,8 +11,7 @@ import time from datetime import datetime from galaxy.exceptions import ObjectInvalid, ObjectNotFound -from galaxy.util import directory_hash_id, umask_fix_perms -from galaxy.util.path import safe_relpath +from galaxy.util import directory_hash_id, safe_relpath, umask_fix_perms from galaxy.util.sleeper import Sleeper from ..objectstore import convert_bytes, ObjectStore diff --git a/lib/galaxy/objectstore/pithos.py b/lib/galaxy/objectstore/pithos.py index 31a1508eed5..6fd88822326 100644 --- a/lib/galaxy/objectstore/pithos.py +++ b/lib/galaxy/objectstore/pithos.py @@ -8,9 +8,9 @@ import shutil from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, + safe_relpath, umask_fix_perms, ) -from galaxy.util.path import safe_relpath from ..objectstore import ObjectStore try: diff --git a/lib/galaxy/objectstore/rods.py b/lib/galaxy/objectstore/rods.py index f5718f8c743..fcf61c0f021 100644 --- a/lib/galaxy/objectstore/rods.py +++ b/lib/galaxy/objectstore/rods.py @@ -13,7 +13,7 @@ from posixpath import dirname as path_dirname from posixpath import join as path_join from galaxy.exceptions import ObjectInvalid, ObjectNotFound -from galaxy.util.path import safe_relpath +from galaxy.util import safe_relpath from ..objectstore import DiskObjectStore, local_extra_dirs diff --git a/lib/galaxy/objectstore/s3.py b/lib/galaxy/objectstore/s3.py index ad312fa872a..ea7863ccdb7 100644 --- a/lib/galaxy/objectstore/s3.py +++ b/lib/galaxy/objectstore/s3.py @@ -22,11 +22,11 @@ except ImportError: from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, + safe_relpath, string_as_bool, umask_fix_perms, which, ) -from galaxy.util.path import safe_relpath from galaxy.util.sleeper import Sleeper from .s3_multipart_upload import multipart_upload diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index 52452ed41c9..d3fbb617043 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -2,7 +2,6 @@ import logging import os import string import time -from errno import ENOENT from xml.etree.ElementTree import ParseError from markupsafe import escape @@ -545,7 +544,7 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin, object): concrete_path = os.path.join(tool_path, path) if not os.path.exists(concrete_path): # This is a lot faster than attempting to load a non-existing tool - raise IOError(ENOENT, os.strerror(ENOENT)) + raise IOError tool_shed_repository = None can_load_into_panel_dict = True @@ -586,8 +585,8 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin, object): labels = item.labels if labels is not None: tool.labels = labels - except (IOError, OSError) as exc: - log.error("Error reading tool configuration file from path '%s': %s", path, exc) + except IOError: + log.error("Error reading tool configuration file from path: %s" % path) except Exception: log.exception("Error reading tool from path: %s", path) diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index d180cfa130f..2b617cd558c 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -860,21 +860,17 @@ def string_as_bool_or_none(string): return False -def listify(item, do_strip=None, strip=False, split=True): +def listify(item, do_strip=False): """ Make a single item a single item list, or return a list if passed a - list. Splits strings on commas unless split=False, strips whitespace - from around comma-split elements if strip=True. Passing a None returns - an empty list. Passing a tuple returns the tuple. + list. Passing a None returns an empty list. """ - if do_strip is not None and strip is False: - strip = do_strip if not item: return [] - elif isinstance(item, list) or isinstance(item, tuple): + elif isinstance(item, list): return item - elif split and isinstance(item, string_types) and item.count(','): - if strip: + elif isinstance(item, string_types) and item.count(','): + if do_strip: return [token.strip() for token in item.split(',')] else: return item.split(',') diff --git a/lib/tool_shed/capsule/capsule_manager.py b/lib/tool_shed/capsule/capsule_manager.py index 54385d23575..5daa0b21c04 100644 --- a/lib/tool_shed/capsule/capsule_manager.py +++ b/lib/tool_shed/capsule/capsule_manager.py @@ -12,9 +12,8 @@ from sqlalchemy import and_, false import tool_shed.repository_types.util as rt_util from galaxy import web -from galaxy.util import asbool, build_url, CHUNK_SIZE +from galaxy.util import asbool, build_url, CHUNK_SIZE, safe_relpath from galaxy.util.odict import odict -from galaxy.util.path import safe_relpath from tool_shed.dependencies import attribute_handlers from tool_shed.dependencies.repository.relation_builder import RelationBuilder from tool_shed.galaxy_install.repository_dependencies.repository_dependency_manager import RepositoryDependencyInstallManager