Skip to content

Commit

Permalink
Merge branch 'release_24.0' into release_24.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed May 30, 2024
2 parents b163591 + 7135560 commit 6ef6fc9
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 10 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/config/sample/tool_shed.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ tool_shed:
# installation directory.
#hgweb_config_dir: null

# Default URL prefix for repositories served via hgweb. If running an
# external hgweb server you should set this to an empty string.
#hgweb_repo_prefix: repos/

# Allow pushing directly to mercurial repositories directly and
# without authentication.
#config_hg_for_dev: null
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy/config/schemas/tool_shed_config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ mapping:
Where the hgweb.config file is stored.
The default is the Galaxy installation directory.
hgweb_repo_prefix:
type: str
required: false
default: repos/
desc: |
Default URL prefix for repositories served via hgweb.
If running an external hgweb server you should set this to an empty string.
config_hg_for_dev:
type: str
required: false
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/managers/citations.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def _raw_get_bibtex(self, doi):
# content encoding from the Content-Type header (res.encoding), and if
# that fails, falls back to guessing from the content itself (res.apparent_encoding).
# The guessed encoding is sometimes wrong, better to default to utf-8.
res.raise_for_status()
if res.encoding is None:
res.encoding = "utf-8"
return res.text
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/services/dataset_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def serialize_element(dsc_element) -> DCESummary:
hdca_id=self.encode_id(hdca.id),
parent_id=self.encode_id(result["object"]["id"]),
)
else:
elif result["element_type"] == DCEType.hda:
result["object"]["accessible"] = self.hda_manager.is_accessible(dsc_element.element_object, trans.user)
return result

Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy_test/driver/uses_shed.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import string
import tempfile
from typing import ClassVar
from unittest import SkipTest

from galaxy.app import UniverseApplication
from galaxy.model.base import transaction
from galaxy.util.tool_shed.tool_shed_registry import DEFAULT_TOOL_SHED_URL
from galaxy.util.unittest_utils import is_site_up
from galaxy_test.base.populators import DEFAULT_TIMEOUT
from galaxy_test.base.uses_shed_api import UsesShedApi
from galaxy_test.driver.driver_util import (
Expand Down Expand Up @@ -47,6 +50,8 @@ def _app(self) -> UniverseApplication: ...

@classmethod
def configure_shed(cls, config):
if not is_site_up(DEFAULT_TOOL_SHED_URL):
raise SkipTest(f"Test depends on [{DEFAULT_TOOL_SHED_URL}] being up and it appears to be down.")
cls.shed_tools_dir = tempfile.mkdtemp()
cls.shed_tool_data_dir = tempfile.mkdtemp()
cls._test_driver.temp_directories.extend([cls.shed_tool_data_dir, cls.shed_tools_dir])
Expand Down
11 changes: 5 additions & 6 deletions lib/tool_shed/util/hgweb_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class HgWebConfigManager:
def __init__(self):
self.hgweb_config_dir = None
self.in_memory_config = None
self.lock = threading.Lock()

def add_entry(self, lhs, rhs):
"""Add an entry in the hgweb.config file for a new repository."""
lock = threading.Lock()
lock.acquire(True)
self.lock.acquire(True)
try:
# Since we're changing the config, make sure the latest is loaded into memory.
self.read_config(force_read=True)
Expand All @@ -38,12 +38,11 @@ def add_entry(self, lhs, rhs):
except Exception as e:
log.debug("Exception in HgWebConfigManager.add_entry(): %s", unicodify(e))
finally:
lock.release()
self.lock.release()

def change_entry(self, old_lhs, new_lhs, new_rhs):
"""Change an entry in the hgweb.config file for a repository - this only happens when the owner changes the name of the repository."""
lock = threading.Lock()
lock.acquire(True)
self.lock.acquire(True)
try:
self.make_backup()
# Remove the old entry.
Expand All @@ -55,7 +54,7 @@ def change_entry(self, old_lhs, new_lhs, new_rhs):
except Exception as e:
log.debug("Exception in HgWebConfigManager.change_entry(): %s", unicodify(e))
finally:
lock.release()
self.lock.release()

def get_entry(self, lhs):
"""Return an entry in the hgweb.config file for a repository"""
Expand Down
2 changes: 1 addition & 1 deletion lib/tool_shed/util/repository_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def create_repository(
# Create the local repository.
init_repository(repo_path=repository_path)
# Add an entry in the hgweb.config file for the local repository.
lhs = f"repos/{repository.user.username}/{repository.name}"
lhs = f"{app.config.hgweb_repo_prefix}{repository.user.username}/{repository.name}"
app.hgweb_config_manager.add_entry(lhs, repository_path)
# Create a .hg/hgrc file for the local repository.
create_hgrc_file(app, repository)
Expand Down
10 changes: 8 additions & 2 deletions test/unit/app/managers/test_CitationsManager_db.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from unittest import SkipTest

import requests
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options

Expand Down Expand Up @@ -29,8 +32,11 @@ def test_DoiCache(url_factory): # noqa: F811
with create_and_drop_database(db_url):
doi_cache = MockDoiCache(galaxy.config.GalaxyAppConfiguration(override_tempdir=False), db_url)
assert is_cache_empty(db_url, "doi")
assert "Jörg" in doi_cache.get_bibtex("10.1093/bioinformatics/bts252")
assert "Özkurt" in doi_cache.get_bibtex("10.1101/2021.12.24.474111")
try:
assert "Jörg" in doi_cache.get_bibtex("10.1093/bioinformatics/bts252")
assert "Özkurt" in doi_cache.get_bibtex("10.1101/2021.12.24.474111")
except requests.exceptions.RequestException as e:
raise SkipTest(f"dx.doi failed to respond: {e}")
assert not is_cache_empty(db_url, "doi")
doi_cache._cache.clear()
assert is_cache_empty(db_url, "doi")
2 changes: 2 additions & 0 deletions test/unit/app/test_galaxy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
from galaxy.tool_shed.unittest_utils import StandaloneInstallationTarget
from galaxy.tool_shed.util.repository_util import check_for_updates
from galaxy.util.tool_shed.tool_shed_registry import DEFAULT_TOOL_SHED_URL
from galaxy.util.unittest_utils import skip_if_site_down


@skip_if_site_down(DEFAULT_TOOL_SHED_URL)
def test_against_production_shed(tmp_path: Path):
repo_owner = "iuc"
repo_name = "featurecounts"
Expand Down

0 comments on commit 6ef6fc9

Please sign in to comment.