Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.0.3
- fix: compatibility with setuptools>=82 (no `pkg_resources`),
which is shipped with CKAN 2.11.6
1.0.2
- enh: wrap long strings in tabular info view
- tests: own the docker image
Expand Down
12 changes: 11 additions & 1 deletion ckanext/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
__import__('pkg_resources').declare_namespace(__name__)
# encoding: utf-8

# this is a namespace package
# (same as in CKAN, compatible with setuptools<82 and setuptools>=82,
# which does not ship `pkg_resources` anymore)
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
10 changes: 10 additions & 0 deletions ckanext/dc_view/tests/test_setuptools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import subprocess
import sys


def test_import_without_pkg_resources():
"""setuptools>=82 does not ship `pkg_resources` (e.g. CKAN 2.11.6)"""
code = ("import sys; "
"sys.modules['pkg_resources'] = None; " # import raises an error
"import ckanext.dc_view.plugin")
subprocess.check_call([sys.executable, "-c", code])
Loading