summaryrefslogtreecommitdiff
path: root/src/mailman/core/initialize.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-02-27 10:52:12 -0500
committerBarry Warsaw2012-02-27 10:52:12 -0500
commitf9e08a392daa5e7e5270a2cab4fce9723a6811b5 (patch)
tree4324f12d8436606edf1e35acc02a1f4216b7e109 /src/mailman/core/initialize.py
parentb6fdf26f8003dd8441d86ffc23666efce0f92c34 (diff)
downloadmailman-f9e08a392daa5e7e5270a2cab4fce9723a6811b5.tar.gz
mailman-f9e08a392daa5e7e5270a2cab4fce9723a6811b5.tar.zst
mailman-f9e08a392daa5e7e5270a2cab4fce9723a6811b5.zip
Diffstat (limited to 'src/mailman/core/initialize.py')
-rw-r--r--src/mailman/core/initialize.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mailman/core/initialize.py b/src/mailman/core/initialize.py
index 8339eb825..721877056 100644
--- a/src/mailman/core/initialize.py
+++ b/src/mailman/core/initialize.py
@@ -37,6 +37,7 @@ __all__ = [
import os
+import sys
from pkg_resources import resource_string
from zope.configuration import xmlconfig
@@ -63,19 +64,25 @@ def search_for_configuration_file():
config_path = os.getenv('MAILMAN_CONFIG_FILE')
# Both None and the empty string are considered "missing".
if config_path and os.path.exists(config_path):
- return config_path
+ return os.path.abspath(config_path)
# ./mailman.cfg
config_path = os.path.abspath('mailman.cfg')
if os.path.exists(config_path):
- return config_path
+ return os.path.abspath(config_path)
# ~/.mailman.cfg
config_path = os.path.join(os.getenv('HOME'), '.mailman.cfg')
if os.path.exists(config_path):
- return config_path
+ return os.path.abspath(config_path)
# /etc/mailman.cfg
config_path = '/etc/mailman.cfg'
if os.path.exists(config_path):
- return config_path
+ return os.path.abspath(config_path)
+ # $argv0/../../etc/mailman.cfg
+ bindir = os.path.dirname(sys.argv[0])
+ parent = os.path.dirname(bindir)
+ config_path = os.path.join(parent, 'etc', 'mailman.cfg')
+ if os.path.exists(config_path):
+ return os.path.abspath(config_path)
# Are there any others we should search by default?
return None