commit 384c7cacd7a58b4c6a90c0df21d176f235568401
parent 40281a3193e7d3b6da5b03ea1196fa29a2452258
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 29 Feb 2016 14:27:21 +0100
Merge pull request #1695 from drizzt/master
Fix installation when --root is specified
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
@@ -7,6 +7,7 @@ import os
import sys
import platform
import imp
+import argparse
version = imp.load_source('version', 'lib/version.py')
@@ -16,8 +17,12 @@ if sys.version_info[:3] < (2, 7, 0):
data_files = []
if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--root=', dest='root_path', metavar='dir', default='/')
+ opts, _ = parser.parse_known_args(sys.argv[1:])
usr_share = os.path.join(sys.prefix, "share")
- if not os.access(usr_share, os.W_OK):
+ if not os.access(opts.root_path + usr_share, os.W_OK) and \
+ not os.access(opts.root_path, os.W_OK):
if 'XDG_DATA_HOME' in os.environ.keys():
usr_share = os.environ['$XDG_DATA_HOME']
else: