5
# The explanations file contains tracebacks - these are highly sensitive to
6
# changes in the code, so are kept alongside the code.
7
explanations_file = os.path.join(os.path.dirname(__file__),
12
from udd import iconfig
13
return iconfig.Iconfig().get('pkgimport.base_dir')
15
# Paths relative to the base_dir
17
def __getattr__(self, name):
18
return os.path.join(self.base_dir, getattr(self, "_" + name))
20
# Common across multiple components:
21
_sqlite_file = "meta.db"
22
_sqlite_package_file = "packages.db"
23
_sqlite_history_file = "history.db"
25
# FIXME: This is needed for tests and tests may be run in various dirs,
26
# creating a new credentials file for any random branch is not optimal :-)
28
# FIXME: Keeping a local credentials file doesn't feel right, when we have a
29
# newer launchpadlib, we should try to offload this to relying on its APIs.
31
_lp_creds_file = "lp_creds.txt"
33
# Used by mass_import.py:
34
_stop_file = "STOP_PLEASE"
35
_max_threads_file = "max_threads"
37
# Used by import_package.py:
40
_updates_dir = "updates"
41
_download_cache_dir = "download-cache"
42
_localbranches_dir = "localbranches"
43
_debian_diffs_dir = os.path.join("www", "diffs")
44
_ubuntu_merge_dir = os.path.join("www", "merges")
46
# Used by categorize_failures.py:
48
_web_status_dir = os.path.join("www", "status")
50
_override_root_dir = None
52
# The directory that the udd code lives in.
53
def get_root_dir(self):
54
override_root_dir = getattr(self, '_override_root_dir', None)
55
if override_root_dir is not None:
56
return override_root_dir
57
return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
60
def set_root_dir(self, new_dir):
61
self._override_root_dir = new_dir
63
root_dir = property(get_root_dir, set_root_dir)
66
def static_file_path(self, filename):
67
"""Return the path to the static resource file, 'filename'."""
68
return os.path.join(self.root_dir, filename)