Skip to content

Commit

Permalink
Add setup.py
Browse files Browse the repository at this point in the history
Fix electrum_rpc.py
Rename server_main.py to electrumx_server.py
  • Loading branch information
Neil Booth committed Nov 5, 2016
1 parent 7019b29 commit 6946863
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 6 deletions.
8 changes: 5 additions & 3 deletions electrumx_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ def main():
parser = argparse.ArgumentParser('Send electrumx an RPC command' )
parser.add_argument('-p', '--port', metavar='port_num', type=int,
help='RPC port number')
parser.add_argument('command', nargs='*', default=[],
parser.add_argument('command', nargs=1, default=[],
help='command to send')
parser.add_argument('param', nargs='*', default=[],
help='params to send')
args = parser.parse_args()

if args.port is None:
args.port = int(environ.get('ELECTRUMX_RPC_PORT', 8000))

payload = {'method': args.command[0], 'params': args.command[1:]}
payload = {'method': args.command[0], 'params': args.param}

loop = asyncio.get_event_loop()
proto_factory = partial(RPCClient, loop)
Expand All @@ -60,7 +62,7 @@ def main():
protocol.send(payload)
loop.run_forever()
except OSError:
print('error connecting - is ElectrumX running?')
print('error connecting - is ElectrumX catching up or not running?')
finally:
loop.close()

Expand Down
File renamed without changes.
Empty file added lib/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion samples/scripts/NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ The following environment variables are required:

DB_DIRECTORY - path to the database directory (if relative, to `run` script)
USERNAME - the username the server will run as if using `run` script
SERVER_MAIN - path to the server_main.py script (if relative, to `run` script)
ELECTRUMX - path to the electrumx_server.py script (if relative,
to `run` script)
DAEMON_URL - the URL used to connect to the daemon. Should be of the form
http://username:password@hostname:port/
Alternatively you can specify DAEMON_USERNAME, DAEMON_PASSWORD,
Expand Down
1 change: 1 addition & 0 deletions samples/scripts/env/ELECTRUMX
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/path/to/electrumx_server.py
1 change: 0 additions & 1 deletion samples/scripts/env/SERVER_MAIN

This file was deleted.

2 changes: 1 addition & 1 deletion samples/systemd-unit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After=network.target

[Service]
EnvironmentFile=/etc/electrumx.conf
ExecStart=/home/electrumx/electrumx/server_main.py
ExecStart=/usr/local/bin/electrumx_server.py
User=electrumx

[Install]
Expand Down
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import setuptools
from server.version import VERSION


setuptools.setup(
name='electrumx',
version=VERSION.split()[-1],
scripts=['electrumx_server.py', 'electrumx_rpc.py'],
python_requires='>=3.5',
install_requires=['plyvel', 'aiohttp >= 1'],
packages=setuptools.find_packages(),
description='ElectrumX Server',
author='Neil Booth',
author_email='[email protected]',
license='MIT Licence',
url='https://github.com/kyuupichan/electrumx/',
long_description='Server implementation for the Electrum wallet',
classifiers=[
'Development Status :: 3 - Alpha',
'Topic :: Internet',
'License :: OSI Approved :: MIT License',
'Operating System :: Unix',
],
)

0 comments on commit 6946863

Please sign in to comment.