Assume that the resource path is always next to the libdir.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
bup_libdir="$script_home/../lib" # bup_libdir will be adjusted during install
export PYTHONPATH="$bup_libdir${PYTHONPATH:+:$PYTHONPATH}"
-export BUP_RESOURCE_PATH="$bup_libdir"
# This last line will be replaced with 'exec some/python "$@"
from bup import options, git, vfs
from bup.helpers import (chunkyreader, debug1, format_filesize, handle_ctrl_c,
- log, resource_path, saved_errors)
+ log, saved_errors)
from bup.metadata import Metadata
+from bup.path import resource_path
from bup.repo import LocalRepo
try:
return _hostname
-_resource_path = None
-def resource_path(subdir=''):
- global _resource_path
- if not _resource_path:
- _resource_path = os.environ.get('BUP_RESOURCE_PATH') or '.'
- return os.path.join(_resource_path, subdir)
-
def format_filesize(size):
unit = 1024.0
size = float(size)
# we could use realpath here and save some stats...
_libdir = os.path.abspath(os.path.dirname(__file__) + '/..')
+_resdir = _libdir
_exedir = os.path.abspath(_libdir + '/cmd')
_exe = os.path.join(_exedir, 'bup')
def libdir():
return _libdir
+
+def resource_path(subdir=''):
+ return os.path.join(_resdir, subdir)