]> arthur.barton.de Git - bup.git/commitdiff
Drop BUP_RESOURCE_PATH; find it via __file__
authorRob Browning <rlb@defaultvalue.org>
Sat, 12 Oct 2019 22:58:16 +0000 (17:58 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 15 Dec 2019 20:57:33 +0000 (14:57 -0600)
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>
cmd/python-cmd.sh
cmd/web-cmd.py
lib/bup/helpers.py
lib/bup/path.py

index 30a843487d28dd3e1b449b2917032dc7e40853b1..8449bc8b722ca7ee8c2977a63324fd6591b80b38 100644 (file)
@@ -35,6 +35,5 @@ export LC_CTYPE=ISO-8859-1
 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 "$@"
index 810af2d069e610e8a8c054a9c7fd2391016f8c6e..eeb9107d3e93e19e98c2c1bb61a7cf68d571d82b 100755 (executable)
@@ -11,8 +11,9 @@ import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
 
 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:
index f6b71cd1c7f643ba786f01ad1e94493a62e22d76..b962b73fb6d862e7b03e8c09a334db1cbbd569e8 100644 (file)
@@ -395,13 +395,6 @@ def hostname():
     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)
index 7a4f31cde52d9981cbe5ca9392548010d60d0eb0..b6167d075fd88689b45b81f1dadb2a45c7b5e1ec 100644 (file)
@@ -7,6 +7,7 @@ import os
 # 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')
 
@@ -21,3 +22,6 @@ cmddir = exedir
 
 def libdir():
     return _libdir
+
+def resource_path(subdir=''):
+    return os.path.join(_resdir, subdir)