commit a34d9a380c65135ed6e89a6977feba797bf970f6
parent cd1ad84ed9319536e1696c02f10c2af8df2738cc
Author: ThomasV <thomasv1@gmx.de>
Date: Sun, 4 Aug 2013 12:37:37 -0700
Merge pull request #258 from tuxcanfly/master
fixes #245: use alternate datafiles location
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git 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"]),