Browse Source

move wordlists to data dir

283
ThomasV 10 years ago
parent
commit
0606a30804
  1. 0
      data/wordlist/english.txt
  2. 0
      data/wordlist/japanese.txt
  3. 0
      data/wordlist/portuguese.txt
  4. 0
      data/wordlist/spanish.txt
  5. 4
      gui/qt/lite_window.py
  6. 3
      lib/mnemonic.py
  7. 9
      lib/util.py
  8. 5
      setup.py

0
lib/wordlist/english.txt → data/wordlist/english.txt

0
lib/wordlist/japanese.txt → data/wordlist/japanese.txt

0
lib/wordlist/portuguese.txt → data/wordlist/portuguese.txt

0
lib/wordlist/spanish.txt → data/wordlist/spanish.txt

4
gui/qt/lite_window.py

@ -76,9 +76,7 @@ def theme_dirs_from_prefix(prefix):
def load_theme_paths(): def load_theme_paths():
theme_paths = {} theme_paths = {}
prefixes = (util.local_data_dir(), util.appdata_dir()) theme_paths.update(theme_dirs_from_prefix(util.data_dir()))
for prefix in prefixes:
theme_paths.update(theme_dirs_from_prefix(prefix))
return theme_paths return theme_paths

3
lib/mnemonic.py

@ -26,6 +26,7 @@ import string
import ecdsa import ecdsa
import pbkdf2 import pbkdf2
import util
from util import print_error from util import print_error
from bitcoin import is_old_seed, is_new_seed from bitcoin import is_old_seed, is_new_seed
import version import version
@ -46,7 +47,7 @@ class Mnemonic(object):
def __init__(self, lang='en'): def __init__(self, lang='en'):
filename = filenames.get(lang[0:2], 'english.txt') 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 = open(path,'r').read().strip()
s = unicodedata.normalize('NFKD', s.decode('utf8')) s = unicodedata.normalize('NFKD', s.decode('utf8'))
lines = s.split('\n') lines = s.split('\n')

9
lib/util.py

@ -54,6 +54,15 @@ def user_dir():
#raise Exception("No home directory found in environment variables.") #raise Exception("No home directory found in environment variables.")
return return
def data_dir():
import __builtin__
if __builtin__.use_local_modules:
return local_data_dir()
else:
return appdata_dir()
def appdata_dir(): def appdata_dir():
"""Find the path to the application data directory; add an electrum folder and return path.""" """Find the path to the application data directory; add an electrum folder and return path."""
if platform.system() == "Windows": if platform.system() == "Windows":

5
setup.py

@ -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): 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])) 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() appdata_dir = util.appdata_dir()
if not os.access(appdata_dir, os.W_OK): 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")
@ -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 # 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") os.system("pip install http://download.electrum.org/tlslite-0.4.5.tar.gz")
@ -91,7 +95,6 @@ setup(
'electrum.verifier', 'electrum.verifier',
'electrum.version', 'electrum.version',
'electrum.wallet', 'electrum.wallet',
'electrum.wallet_bitkey',
'electrum.x509', 'electrum.x509',
'electrum_gui.gtk', 'electrum_gui.gtk',
'electrum_gui.qt.__init__', 'electrum_gui.qt.__init__',

Loading…
Cancel
Save