Browse Source

Merge pull request #2 from DevelopAndOperate/master

Added version reporting. Changed default currency to Bitcoin Cash.
master
Teran McKinney 3 years ago
committed by GitHub
parent
commit
10b621bc59
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      setup.py
  2. 6
      sporestack/__init__.py
  3. 11
      sporestack/cli.py
  4. 2
      test.sh
  5. 6
      test_sporestack.py

9
setup.py

@ -2,7 +2,14 @@
from setuptools import setup
VERSION = '0.7.1'
VERSION = None
with open('sporestack/__init__.py') as f:
for line in f:
if line.startswith('__version__'):
VERSION = line.replace("'", '').split('=')[1].strip()
break
if VERSION is None:
raise ValueError('__version__ not found in __init__.py')
DOWNLOAD_URL = 'https://github.com/sporestack/sporestack-python/tarball/{}'

6
sporestack/__init__.py

@ -15,6 +15,8 @@ try:
except ImportError:
from urllib2 import urlopen, HTTPError
__version__ = '0.7.1'
DEFAULT_ENDPOINT = 'https://sporestack.com'
TIMEOUT = 60
@ -96,7 +98,7 @@ class SporeStack():
dcid=None,
flavor=None,
paycode=None,
currency='btc'):
currency='bch'):
"""
Returns a node
@ -166,7 +168,7 @@ class SporeStack():
days,
uuid,
paycode=None,
currency='btc'):
currency='bch'):
"""
Lets you raise the end_of_life on a node.

11
sporestack/cli.py

@ -14,7 +14,7 @@ import warnings
from socket import gethostbyname
import pyqrcode
from sporestack import SporeStack
from sporestack import SporeStack, __version__
DOT_FILE_PATH = '{}/.sporestack'.format(os.getenv('HOME'))
@ -333,7 +333,7 @@ def spawn(uuid,
ssh_connect=False,
ssh_user='root',
wallet_command=None,
currency='btc'):
currency='bch'):
"""
Spawn a node.
"""
@ -533,6 +533,9 @@ def options(args):
def main():
parser = argparse.ArgumentParser(description='SporeStack.com CLI.')
parser.add_argument('--version', action='version',
version='SporeStack {version}'.
format(version=__version__))
parser.add_argument('--endpoint',
help='Use alternate SporeStack endpoint.',
default='https://sporestack.com')
@ -679,7 +682,7 @@ def main():
default=None)
spawn_subparser.add_argument('--currency',
help='Cryptocurrency to pay with',
default='btc')
default='bch')
help_text = 'Run payment with (command) (address) (satoshis)'
spawn_subparser.add_argument('--wallet_command',
help=help_text,
@ -701,7 +704,7 @@ def main():
default=None)
topup_subparser.add_argument('--currency',
help='Cryptocurrency to pay with',
default='btc')
default='bch')
help_text = 'Run payment with (command) (address) (satoshis)'
topup_subparser.add_argument('--wallet_command',
help=help_text,

2
test.sh

@ -4,7 +4,7 @@ set -e
nosetests-2.7
nosetests-3.5
nosetests3
python2 sporestack/cli.py 2>&1 | grep arguments
python3 sporestack/cli.py 2>&1 | grep arguments

6
test_sporestack.py

@ -1,11 +1,17 @@
from uuid import uuid4 as random_uuid
import sporestack
import re
from nose.tools import raises
SporeStack = sporestack.SporeStack()
def test_version():
version = sporestack.__version__
assert bool(re.match(r'^(\d+)\.(\d+)\.(\d+)$', version))
def test__sshkey_strip():
assert sporestack._sshkey_strip(None) == None
full_sshkey = 'ssh-rsa AAAA foo@foo'

Loading…
Cancel
Save