setup package in lib subdirectory

This commit is contained in:
thomasv 2012-05-10 14:38:49 +02:00
parent ca15ae6891
commit b8773178a1
18 changed files with 43 additions and 29 deletions

View File

@ -2,6 +2,7 @@ include README LICENCE RELEASE-NOTES
include *.py
include electrum
exclude setup.py
recursive-include lib *.py
recursive-include ecdsa *.py
recursive-include aes *.py
include icons.qrc

21
README
View File

@ -30,17 +30,22 @@ In order to use the gtk gui, you need pygtk and tk.
* apt-get install python-tk
To install Electrum, type:
sudo python setup.py install
RUN
To start the Qt gui, type:
python electrum
To use the Gtk gui, type:
python electrum --gui gtk
To start Electrum in GUI mode, type:
If arguments are passed to the command line, Electrum will run in text mode.
Examples:
python electrum balance
python electrum help
electrum
If arguments are passed to the command line, Electrum will run in text mode:
electrum balance
electrum help

4
blocks
View File

@ -1,8 +1,8 @@
#!/usr/bin/env python
import interface
from electrum import TcpStratumInterface
i = interface.TcpStratumInterface('ecdsa.org', 50001)
i = TcpStratumInterface('ecdsa.org', 50001)
i.start()
i.send([('blockchain.numblocks.subscribe',[])])

View File

@ -18,11 +18,11 @@
import re, sys, getpass
import electrum
from optparse import OptionParser
from wallet import Wallet, SecretToASecret
from interface import WalletSynchronizer
from decimal import Decimal
from wallet import format_satoshis
from electrum import Wallet, SecretToASecret, WalletSynchronizer, format_satoshis
known_commands = ['help', 'validateaddress', 'balance', 'contacts', 'create', 'restore', 'payto', 'sendtx', 'password', 'addresses', 'history', 'label', 'mktx','seed','import','signmessage','verifymessage','eval']
offline_commands = ['password', 'mktx', 'history', 'label', 'contacts', 'help', 'validateaddress', 'signmessage', 'verifymessage', 'eval', 'create', 'addresses', 'import', 'seed']
@ -60,9 +60,9 @@ if __name__ == '__main__':
if cmd == 'gui':
if options.gui=='gtk':
import gui
import electrum.gui as gui
elif options.gui=='qt':
import gui_qt as gui
import electrum.gui_qt as gui
else:
print "unknown gui", options.gui
exit(1)

3
lib/__init__.py Normal file
View File

@ -0,0 +1,3 @@
from wallet import Wallet, SecretToASecret, format_satoshis
from interface import WalletSynchronizer
from interface import TcpStratumInterface

View File

View File

@ -22,7 +22,7 @@ import socket, traceback
import pygtk
pygtk.require('2.0')
import gtk, gobject
import pyqrnative
from electrum import pyqrnative
from decimal import Decimal
gtk.gdk.threads_init()
@ -59,7 +59,7 @@ def numbify(entry, is_int = False):
def show_seed_dialog(wallet, password, parent):
import mnemonic
from electrum import mnemonic
try:
seed = wallet.pw_decode( wallet.seed, password)
except:
@ -203,7 +203,7 @@ def run_recovery_dialog(wallet):
try:
seed.decode('hex')
except:
import mnemonic
from electrum import mnemonic
print "not hex, trying decode"
seed = mnemonic.mn_decode( seed.split(' ') )
if not seed:

View File

@ -101,7 +101,7 @@ class QRCodeWidget(QWidget):
self.set_addr(addr)
def set_addr(self, addr):
import pyqrnative
from electrum import pyqrnative
self.addr = addr
self.qr = pyqrnative.QRCode(4, pyqrnative.QRErrorCorrectLevel.L)
self.qr.addData(addr)
@ -688,7 +688,7 @@ class ElectrumWindow(QMainWindow):
@staticmethod
def show_seed_dialog(wallet, parent=None):
import mnemonic
from electrum import mnemonic
if wallet.use_encryption:
password = parent.password_dialog()
if not password: return
@ -796,7 +796,7 @@ class ElectrumWindow(QMainWindow):
qrw.repaint()
def do_save():
import bmp
from electrum import bmp
bmp.save_qrcode(qrw.qr, "qrcode.bmp")
self.show_message("QR code saved to file 'qrcode.bmp'")
@ -936,7 +936,7 @@ class ElectrumWindow(QMainWindow):
seed = unicode(seed_e.text())
seed.decode('hex')
except:
import mnemonic
from electrum import mnemonic
print "not hex, trying decode"
try:
seed = mnemonic.mn_decode( seed.split(' ') )

View File

@ -1,2 +1,2 @@
ELECTRUM_VERSION = "0.47b"
ELECTRUM_VERSION = "0.48"
SEED_VERSION = 4 # bump this everytime the seed generation is modified

4
peers
View File

@ -1,8 +1,8 @@
#!/usr/bin/env python
import interface
from electrum import TcpStratumInterface
i = interface.TcpStratumInterface('ecdsa.org', 50001)
i = TcpStratumInterface('ecdsa.org', 50001)
i.start()
i.send([('server.peers.subscribe',[])])

View File

@ -3,15 +3,18 @@
# python setup.py sdist --format=zip,gztar
from distutils.core import setup
from version import ELECTRUM_VERSION as version
from lib.version import ELECTRUM_VERSION as version
setup(name = "Electrum",
version = version,
package_dir = {'electrum': 'lib'},
scripts= ['electrum', 'watch_address', 'blocks'],
py_modules = ['electrum.version','electrum.wallet','electrum.interface','electrum.gui','electrum.gui_qt','electrum.icons_rc','electrum.mnemonic','electrum.pyqrnative','electrum.bmp'],
description = "Lightweight Bitcoin Wallet",
author = "thomasv",
license = "GNU GPLv3",
url = "http://ecdsa/electrum",
long_description = """Lightweight Bitcoin Wallet"""
)
)

View File

@ -1,12 +1,14 @@
#!/usr/bin/env python
import interface, sys
import sys
from electrum import TcpStratumInterface
try:
addr = sys.argv[1]
except:
print "usage: watch_address <bitcoin_address>"
i = interface.TcpStratumInterface('ecdsa.org', 50001)
i = TcpStratumInterface('ecdsa.org', 50001)
i.start()
i.send([('blockchain.address.subscribe',[addr])])