From 3741d46590507b74d448e30ff61652ba4206c87f Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Sun, 4 Aug 2013 21:07:22 +0530 Subject: [PATCH] fixes #245: use alternate datafiles location --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0ea8aa317..aed56987c 100644 --- a/setup.py +++ b/setup.py @@ -11,18 +11,23 @@ util = imp.load_source('version', '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' +if not os.access(usr_share, os.W_OK): + usr_share = os.getenv("XDG_DATA_HOME", + os.path.join(os.getenv("HOME"), ".local", "share")) + data_files = [] if (len(sys.argv) > 1 and (sys.argv[1] == "sdist")) or (platform.system() != 'Windows' and platform.system() != 'Darwin'): print "Including all files" data_files += [ - ('/usr/share/applications/',['electrum.desktop']), - ('/usr/share/app-install/icons/',['icons/electrum.png']) + (os.path.join(usr_share, 'applications/'),['electrum.desktop']), + (os.path.join(usr_share, 'app-install', 'icons/'),['icons/electrum.png']) ] if not os.path.exists('locale'): os.mkdir('locale') for lang in os.listdir('locale'): if os.path.exists('locale/%s/LC_MESSAGES/electrum.mo'%lang): - data_files.append( ('/usr/share/locale/%s/LC_MESSAGES'%lang, ['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]) ) data_files += [ (util.appdata_dir(), ["data/README"]),