summaryrefslogtreecommitdiff
path: root/src/mailman/utilities/modules.py
diff options
context:
space:
mode:
authorAurélien Bompard2014-10-06 15:58:58 +0200
committerAurélien Bompard2014-10-06 15:58:58 +0200
commit506b0fff2b4b1f068223d6e9cdfb254fd53bcdac (patch)
treed5c4e598fccf67c133179c4d1156252a61c4b8dc /src/mailman/utilities/modules.py
parentcbbac03083357ca928d104d386d9e3008c937581 (diff)
parent061799ef5031977bd343bbe54a6ad809138bdb45 (diff)
downloadmailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.tar.gz
mailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.tar.zst
mailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.zip
Diffstat (limited to 'src/mailman/utilities/modules.py')
-rw-r--r--src/mailman/utilities/modules.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mailman/utilities/modules.py b/src/mailman/utilities/modules.py
index 5dfec95db..9ff0e50cd 100644
--- a/src/mailman/utilities/modules.py
+++ b/src/mailman/utilities/modules.py
@@ -22,6 +22,7 @@ from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
'call_name',
+ 'expand_path',
'find_components',
'find_name',
'scan_module',
@@ -31,7 +32,7 @@ __all__ = [
import os
import sys
-from pkg_resources import resource_listdir
+from pkg_resources import resource_filename, resource_listdir
@@ -110,3 +111,15 @@ def find_components(package, interface):
continue
for component in scan_module(module, interface):
yield component
+
+
+
+def expand_path(url):
+ """Expand a python: path, returning the absolute file system path."""
+ # Is the context coming from a file system or Python path?
+ if url.startswith('python:'):
+ resource_path = url[7:]
+ package, dot, resource = resource_path.rpartition('.')
+ return resource_filename(package, resource + '.cfg')
+ else:
+ return url