tmove wordlists to data dir - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 0606a308042aeb53a34e5420672388f2f25669fb DIR parent 5b84cbe9fbfb6570a5b5062262a02ccf3a851e6c HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 13 Sep 2014 09:58:11 +0200 move wordlists to data dir Diffstat: R lib/wordlist/english.txt -> data/w… | 0 R lib/wordlist/japanese.txt -> data/… | 0 R lib/wordlist/portuguese.txt -> dat… | 0 R lib/wordlist/spanish.txt -> data/w… | 0 M gui/qt/lite_window.py | 4 +--- M lib/mnemonic.py | 3 ++- M lib/util.py | 9 +++++++++ M setup.py | 5 ++++- 8 files changed, 16 insertions(+), 5 deletions(-) --- DIR diff --git a/lib/wordlist/english.txt b/data/wordlist/english.txt DIR diff --git a/lib/wordlist/japanese.txt b/data/wordlist/japanese.txt DIR diff --git a/lib/wordlist/portuguese.txt b/data/wordlist/portuguese.txt DIR diff --git a/lib/wordlist/spanish.txt b/data/wordlist/spanish.txt DIR diff --git a/gui/qt/lite_window.py b/gui/qt/lite_window.py t@@ -76,9 +76,7 @@ def theme_dirs_from_prefix(prefix): def load_theme_paths(): theme_paths = {} - prefixes = (util.local_data_dir(), util.appdata_dir()) - for prefix in prefixes: - theme_paths.update(theme_dirs_from_prefix(prefix)) + theme_paths.update(theme_dirs_from_prefix(util.data_dir())) return theme_paths DIR diff --git a/lib/mnemonic.py b/lib/mnemonic.py t@@ -26,6 +26,7 @@ import string import ecdsa import pbkdf2 +import util from util import print_error from bitcoin import is_old_seed, is_new_seed import version t@@ -46,7 +47,7 @@ class Mnemonic(object): def __init__(self, lang='en'): filename = filenames.get(lang[0:2], 'english.txt') - path = os.path.join(os.path.dirname(__file__), 'wordlist', filename) + path = os.path.join(util.appdata_dir(), 'wordlist', filename) s = open(path,'r').read().strip() s = unicodedata.normalize('NFKD', s.decode('utf8')) lines = s.split('\n') DIR diff --git a/lib/util.py b/lib/util.py t@@ -54,6 +54,15 @@ def user_dir(): #raise Exception("No home directory found in environment variables.") return + +def data_dir(): + import __builtin__ + if __builtin__.use_local_modules: + return local_data_dir() + else: + return appdata_dir() + + def appdata_dir(): """Find the path to the application data directory; add an electrum folder and return path.""" if platform.system() == "Windows": DIR diff --git a/setup.py b/setup.py t@@ -32,6 +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") t@@ -52,6 +53,9 @@ data_files += [ ]) ] +for lang in os.listdir('data/wordlist'): + data_files.append((os.path.join(appdata_dir, 'wordlist'), ['data/wordlist/%s' % lang])) + # replace tlslite because of https://github.com/trevp/tlslite/issues/15 os.system("pip install http://download.electrum.org/tlslite-0.4.5.tar.gz") t@@ -91,7 +95,6 @@ setup( 'electrum.verifier', 'electrum.version', 'electrum.wallet', - 'electrum.wallet_bitkey', 'electrum.x509', 'electrum_gui.gtk', 'electrum_gui.qt.__init__',