tset data_files only when install is invoked - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 0556e7adde5e40402279a8aaf56e6bf6ff777de8 DIR parent 575cfe313fbc0a234cf40d5a2c03a6580a033455 HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 22 Nov 2014 14:03:21 +0100 set data_files only when install is invoked Diffstat: M setup.py | 58 +++++++++++++++++-------------- 1 file changed, 31 insertions(+), 27 deletions(-) --- DIR diff --git a/setup.py b/setup.py t@@ -15,16 +15,19 @@ util = imp.load_source('util', 'lib/util.py') if sys.version_info[:3] < (2, 7, 0): sys.exit("Error: Electrum requires Python version >= 2.7.0...") -usr_share = util.usr_share_dir() -if not os.access(usr_share, os.W_OK): - try: - os.mkdir(usr_share) - except: - sys.exit("Error: cannot write to %s.\nIf you do not have root permissions, you may install Electrum in 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'): + +if (len(sys.argv) > 1) and (sys.argv[1] == "install"): + # or (platform.system() != 'Windows' and platform.system() != 'Darwin'): print "Including all files" + data_files = [] + usr_share = util.usr_share_dir() + if not os.access(usr_share, os.W_OK): + try: + os.mkdir(usr_share) + except: + sys.exit("Error: cannot write to %s.\nIf you do not have root permissions, you may install Electrum in a virtualenv.\nAlso, please note that you can run Electrum without installing it on your system."%usr_share) + data_files += [ (os.path.join(usr_share, 'applications/'), ['electrum.desktop']), (os.path.join(usr_share, 'app-install', 'icons/'), ['icons/electrum.png']) t@@ -35,27 +38,28 @@ 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 = os.path.join(usr_share, "electrum") - -data_files += [ - (appdata_dir, ["data/README"]), - (os.path.join(appdata_dir, "cleanlook"), [ - "data/cleanlook/name.cfg", - "data/cleanlook/style.css" - ]), - (os.path.join(appdata_dir, "sahara"), [ - "data/sahara/name.cfg", - "data/sahara/style.css" - ]), - (os.path.join(appdata_dir, "dark"), [ - "data/dark/name.cfg", - "data/dark/style.css" - ]) -] -for lang in os.listdir('data/wordlist'): - data_files.append((os.path.join(appdata_dir, 'wordlist'), ['data/wordlist/%s' % lang])) + appdata_dir = os.path.join(usr_share, "electrum") + data_files += [ + (appdata_dir, ["data/README"]), + (os.path.join(appdata_dir, "cleanlook"), [ + "data/cleanlook/name.cfg", + "data/cleanlook/style.css" + ]), + (os.path.join(appdata_dir, "sahara"), [ + "data/sahara/name.cfg", + "data/sahara/style.css" + ]), + (os.path.join(appdata_dir, "dark"), [ + "data/dark/name.cfg", + "data/dark/style.css" + ]) + ] + for lang in os.listdir('data/wordlist'): + data_files.append((os.path.join(appdata_dir, 'wordlist'), ['data/wordlist/%s' % lang])) +else: + data_files = [] setup( name="Electrum",