electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit b8a5d4146d65a6d1523d15fa2cccc5788642d38d
parent ffbabc63e91cdb02386905a53cc68de34c7b173a
Author: ThomasV <thomasv@gitorious>
Date:   Thu, 23 Oct 2014 21:25:14 +0200

Do not use XDG_DATA_HOME. Tell user to use virtualenv if they are not root

Diffstat:
Mlib/util.py | 4+++-
Msetup.py | 11++++-------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/util.py b/lib/util.py @@ -62,13 +62,15 @@ def data_dir(): else: return appdata_dir() +def usr_share_dir(): + return os.path.join(sys.prefix, "share") def appdata_dir(): """Find the path to the application data directory; add an electrum folder and return path.""" if platform.system() == "Windows": return os.path.join(os.environ["APPDATA"], "Electrum") elif platform.system() == "Linux": - return os.path.join(sys.prefix, "share", "electrum") + return os.path.join(usr_share_dir(), "electrum") elif (platform.system() == "Darwin" or platform.system() == "DragonFly" or platform.system() == "OpenBSD" or diff --git a/setup.py b/setup.py @@ -10,14 +10,14 @@ import imp version = imp.load_source('version', 'lib/version.py') -util = imp.load_source('version', 'lib/util.py') +util = imp.load_source('util', 'lib/util.py') if sys.version_info[:3] < (2, 6, 0): sys.exit("Error: Electrum requires Python version >= 2.6.0...") -usr_share = '/usr/share' +usr_share = util.usr_share_dir() if not os.access(usr_share, os.W_OK): - usr_share = os.getenv("XDG_DATA_HOME", os.path.join(os.getenv("HOME"), ".local", "share")) + sys.exit("Error: cannot write to %s.\nIf you do not have root permissions, you may install Electrum a virtualenv.\nAlso, please note that you can run Electrum without installing it on your system."%usr_share) data_files = [] if (len(sys.argv) > 1 and (sys.argv[1] == "sdist")) or (platform.system() != 'Windows' and platform.system() != 'Darwin'): @@ -32,10 +32,7 @@ if (len(sys.argv) > 1 and (sys.argv[1] == "sdist")) or (platform.system() != 'Wi if os.path.exists('locale/%s/LC_MESSAGES/electrum.mo' % lang): data_files.append((os.path.join(usr_share, 'locale/%s/LC_MESSAGES' % lang), ['locale/%s/LC_MESSAGES/electrum.mo' % lang])) - -appdata_dir = util.appdata_dir() -if not os.access(appdata_dir, os.W_OK): - appdata_dir = os.path.join(usr_share, "electrum") +appdata_dir = os.path.join(usr_share, "electrum") data_files += [ (appdata_dir, ["data/README"]),