diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 377b24fd0..2e1edf9ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,10 @@ cache: - .cache/pip - .env/ +stages: + - testing + - releasing + before_script: - docker info # Print out docker version for debugging - python -V # Print out python version for debugging @@ -23,6 +27,7 @@ before_script: - source .env/bin/activate test: + stage: testing script: - pip3 install -r requirements.txt - pip3 install -e . @@ -30,3 +35,21 @@ test: # - python3 tests/conftest.py - pytest --docker +release: + stage: releasing + only: + - tags + script: + - pip3 install setuptools wheel twine + # verifying the version number follows vx.y.z (e.g. "v1.2.3") + - if ! [[ $CI_COMMIT_TAG =~ ^v[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then exit 1; fi + # set version number in setup.py + - echo Releasing $CI_COMMIT_TAG + - sed -i "s/version=\".*/version=\"$CI_COMMIT_TAG\",/" setup.py + - cat setup.py + - python3 setup.py sdist bdist_wheel + # twine ready the password from the env-var TWINE_PASSWORD + # Add --repository-url https://test.pypi.org/legacy/ for testing the release procedure + - ls -l dist && python3 -m twine upload --verbose --user __token__ dist/* + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..06bcb714a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +Specter-desktop is an Open Source Project under the MIT-License and everyone is invited to contribute to it. + +We haven't created many explicit processes and rely on the best practices of Open Source projects. If you want to contribute, fork the project and create a PR. + +If it's necessary to add processes, we'll probably looking into Pieter Hintjens' [Social Architecture](https://hintjens.gitbooks.io/social-architecture/content/) and specifically the C4 process. Pieter is excplicitely mentioning two roles: Contributors and maintainers. + +Thank you very much to all our [Contributors](https://github.com/cryptoadvance/specter-desktop/graphs/contributors). +We're planning to mention individual contributors on the release-notes of each new release. + +The maintainers are the once who are able to merge PRs and create tags/releases. They are listed as "authors" in setup.py. + +For practical considerations of a dev-setup, please have a look in the [DEVELOPMENT.md](./DEVELOPMENT.md). If you need support, join our [Telegram group](https://t.me/spectersupport). diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index f3ff5218c..2f6716ef6 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -25,7 +25,7 @@ Developing against a bitcoind-API makes most sense with the [Regtest Mode](https In order to make the "docker-way" even easier, there is a python-script which detects a running-docker-bitcoind and/or is booting one up. Use it like this: ``` -python3 src/specter/cli.py bitcoind +python3 -m cryptoadvance.specter bitcoind ``` This will also: diff --git a/LICENSE b/LICENSE index ab3e02981..00fa813f8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 cryptoadvance +Copyright (c) 2020 cryptoadvance Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..5163bdb63 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include src/cryptoadvance/specter/templates * +recursive-include src/cryptoadvance/specter/static * +include requirements.txt diff --git a/README.md b/README.md index 84496adf7..d9b1d653b 100755 --- a/README.md +++ b/README.md @@ -30,13 +30,14 @@ cd specter-desktop virtualenv --python=python3 .env source .env/bin/activate pip3 install -r requirements.txt +pip3 install -e . ``` Run the server: ``` cd specter-desktop -python3 src/specter/server.py +python3 -m cryptoadvance.specter server ``` If your Bitcoin Core is using a default data folder the app should detect it automatically. If not, consider setting `rpcuser` and `rpcpassword` in the `bitcoin.conf` file and in the app settings. diff --git a/docs/continuous-integration.md b/docs/continuous-integration.md index fab72f33f..3c152d51e 100644 --- a/docs/continuous-integration.md +++ b/docs/continuous-integration.md @@ -38,7 +38,19 @@ Travis-CI setup is very straightforward. As we're using the build-cache, the bit # Releasing -We're not yet ready to release (semi-) automatically. The current release-artifact is based on pyinstaller. To create the pyinstaller-artifact: +## pip-based release to pypi + +We're about to release (semi-) automatically. The relevant release-artifact is a pip-package which will get released to pypi.org. A manual description of how to create this kind of releases can be found [here](https://packaging.python.org/tutorials/packaging-projects/). + +The automation of that kicks in if someone creates a tag which is named like "vX.Y.Z". This is specified in the gitlab-ci.yml. The release-job will only be triggered in cases of tags. One step will also check that the tag follows the convention above. +The package upload will need a token. How to obtain the token is described in the packaging-tutorial. It's injected via gitlab-variables. ToDo: put the token on a trusted build-node. + +The alternative would have been to use travis-ci for releasing. In that case we would encrypt the token with a private-key from travis and commit to the repo. This looks more safe to me then the above scenario but less safe then the todo, where we're storing the token on the build-node. + + +## Old pyinstaller based releases +The old pyinstaller based artifact will be kept here for the reference: +(attention, hirarchy changed, so below won't work ootb) ``` $ pyinstaller --onefile --clean --paths .env/lib/python3.7/site-packages:src/specter --add-data 'src/specter/templates:templates' --add-binary '.env/bin/hwi:.' --add-data 'src/specter/static:static' src/specter/server.py ``` diff --git a/setup.py b/setup.py index 90810568c..5f1df9865 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,36 @@ -from setuptools import setup, find_packages from glob import glob +from setuptools import find_packages, setup + +with open('requirements.txt') as f: + install_reqs = f.read().strip().split('\n') + + +reqs = [str(ir) for ir in install_reqs if not ir.startswith("#") ] + + +with open("README.md", "r") as fh: + long_description = fh.read() setup( - name="specter-desktop", - packages=find_packages('src/specter'), - package_dir={'': 'src/specter'} -) \ No newline at end of file + name="cryptoadvance.specter", + version="v0.0.11", + author="Stepan Snigirev, Kim Neunert", + author_email="snigirev.stepan@gmail.com, kim.neunert@gmail.com", + description="A GUI for Bitcoin Core optimised to work with airgapped hardware wallets", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/cryptoadvance/specter-desktop", + packages=find_packages('src'), + package_dir={'': 'src'}, + # take METADATA.in into account, include that stuff as well (static/templates) + include_package_data=True, + install_requires=reqs, + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Framework :: Flask", + ], + python_requires='>=3.6', +) diff --git a/src/specter/__init__.py b/src/cryptoadvance/__init__.py similarity index 100% rename from src/specter/__init__.py rename to src/cryptoadvance/__init__.py diff --git a/src/specter/views/__init__.py b/src/cryptoadvance/specter/__init__.py similarity index 100% rename from src/specter/views/__init__.py rename to src/cryptoadvance/specter/__init__.py diff --git a/src/specter/cli.py b/src/cryptoadvance/specter/__main__.py similarity index 71% rename from src/specter/cli.py rename to src/cryptoadvance/specter/__main__.py index 05fc3e9ec..6b373be3b 100644 --- a/src/specter/cli.py +++ b/src/cryptoadvance/specter/__main__.py @@ -1,26 +1,48 @@ -''' Stuff to control a bitcoind-instance. Either directly by access to a bitcoind-executable or - via docker. -''' -import os -import sys import atexit import logging -import shutil -import subprocess -import tempfile +import os +import sys import time import click -import docker -from bitcoind import BitcoindDockerController -from server import DATA_FOLDER -from helpers import which, load_jsons +import docker + +from .bitcoind import (BitcoindDockerController, + fetch_wallet_addresses_for_mining) +from .helpers import load_jsons, which +from .server import DATA_FOLDER, create_app + +DEBUG = True @click.group() def cli(): pass + +@cli.command() +def server(): + app = create_app() + # watch templates folder to reload when something changes + extra_dirs = ['templates'] + extra_files = extra_dirs[:] + for extra_dir in extra_dirs: + for dirname, dirs, files in os.walk(extra_dir): + for filename in files: + filename = os.path.join(dirname, filename) + if os.path.isfile(filename): + extra_files.append(filename) + + # Note: dotenv doesn't convert bools! + if os.getenv('CONNECT_TOR', 'False') == 'True' and os.getenv('TOR_PASSWORD') is not None: + import tor_util + tor_util.run_on_hidden_service( + app, port=os.getenv('PORT'), + debug=DEBUG, extra_files=extra_files + ) + else: + app.run(port=os.getenv('PORT'), debug=DEBUG, extra_files=extra_files) + @cli.command() @click.option('--debug/--no-debug', default=False) @click.option('--mining/--no-mining', default=True) @@ -73,19 +95,6 @@ def bitcoind(debug,mining, docker_tag): click.echo(" --> ",nl=False) time.sleep(mining_every_x_seconds) -def fetch_wallet_addresses_for_mining(data_folder=None): - ''' parses all the wallet-jsons in the folder (default ~/.specter/wallets/regtest) - and returns an array with the addresses - ''' - if data_folder == None: - data_folder = os.path.expanduser(DATA_FOLDER) - wallets = load_jsons(data_folder+"/wallets/regtest") - address_array = [ value['address'] for key, value in wallets.items()] - # remove duplicates - address_array = list( dict.fromkeys(address_array) ) - return address_array - - if __name__ == "__main__": diff --git a/src/specter/bitcoind.py b/src/cryptoadvance/specter/bitcoind.py similarity index 95% rename from src/specter/bitcoind.py rename to src/cryptoadvance/specter/bitcoind.py index 7e43092a5..a002e876a 100644 --- a/src/specter/bitcoind.py +++ b/src/cryptoadvance/specter/bitcoind.py @@ -3,14 +3,18 @@ ''' import atexit import logging +import os import shutil import subprocess import tempfile import time import docker -from rpc import BitcoinCLI, RpcError -from helpers import which + +from .helpers import which +from .server import DATA_FOLDER +from .rpc import BitcoinCLI, RpcError +from .helpers import load_jsons class Btcd_conn: @@ -294,3 +298,16 @@ class BitcoindDockerController(BitcoindController): i = i + 1 if i > 20: raise Exception("Timeout while starting bitcoind-docker-container!") + + +def fetch_wallet_addresses_for_mining(data_folder=None): + ''' parses all the wallet-jsons in the folder (default ~/.specter/wallets/regtest) + and returns an array with the addresses + ''' + if data_folder == None: + data_folder = os.path.expanduser(DATA_FOLDER) + wallets = load_jsons(data_folder+"/wallets/regtest") + address_array = [ value['address'] for key, value in wallets.items()] + # remove duplicates + address_array = list( dict.fromkeys(address_array) ) + return address_array diff --git a/src/specter/controller.py b/src/cryptoadvance/specter/controller.py similarity index 99% rename from src/specter/controller.py rename to src/cryptoadvance/specter/controller.py index b4ffb30a5..6040477b0 100644 --- a/src/specter/controller.py +++ b/src/cryptoadvance/specter/controller.py @@ -7,11 +7,11 @@ from threading import Thread from flask import Flask, Blueprint, render_template, request, redirect, jsonify from flask_qrcode import QRcode -from helpers import normalize_xpubs, run_shell -from descriptor import AddChecksum -from rpc import BitcoinCLI, RPC_PORTS +from .helpers import normalize_xpubs, run_shell +from .descriptor import AddChecksum +from .rpc import BitcoinCLI, RPC_PORTS -from logic import Specter, purposes, addrtypes +from .logic import Specter, purposes, addrtypes from datetime import datetime import urllib diff --git a/src/specter/descriptor.py b/src/cryptoadvance/specter/descriptor.py similarity index 100% rename from src/specter/descriptor.py rename to src/cryptoadvance/specter/descriptor.py diff --git a/src/specter/helpers.py b/src/cryptoadvance/specter/helpers.py similarity index 100% rename from src/specter/helpers.py rename to src/cryptoadvance/specter/helpers.py diff --git a/src/specter/logic.py b/src/cryptoadvance/specter/logic.py similarity index 99% rename from src/specter/logic.py rename to src/cryptoadvance/specter/logic.py index d425a95f7..b4da4fce0 100644 --- a/src/specter/logic.py +++ b/src/cryptoadvance/specter/logic.py @@ -1,12 +1,15 @@ -from rpc import BitcoinCLI, RPC_PORTS, autodetect_cli -import os, json, copy -from helpers import deep_update, load_jsons -from collections import OrderedDict -from descriptor import AddChecksum import base64 -from serializations import PSBT -import helpers +import copy +import json +import os import random +from collections import OrderedDict + +from . import helpers +from .descriptor import AddChecksum +from .helpers import deep_update, load_jsons +from .rpc import RPC_PORTS, BitcoinCLI, autodetect_cli +from .serializations import PSBT WALLET_CHUNK = 5 diff --git a/src/specter/rpc.py b/src/cryptoadvance/specter/rpc.py similarity index 100% rename from src/specter/rpc.py rename to src/cryptoadvance/specter/rpc.py diff --git a/src/specter/rpctest.py b/src/cryptoadvance/specter/rpctest.py similarity index 100% rename from src/specter/rpctest.py rename to src/cryptoadvance/specter/rpctest.py diff --git a/src/specter/serializations.py b/src/cryptoadvance/specter/serializations.py similarity index 100% rename from src/specter/serializations.py rename to src/cryptoadvance/specter/serializations.py diff --git a/src/specter/server.py b/src/cryptoadvance/specter/server.py similarity index 57% rename from src/specter/server.py rename to src/cryptoadvance/specter/server.py index 34b76a1cf..6510a987d 100644 --- a/src/specter/server.py +++ b/src/cryptoadvance/specter/server.py @@ -7,14 +7,13 @@ from dotenv import load_dotenv from flask import Flask from flask_qrcode import QRcode -from descriptor import AddChecksum -from logic import Specter -from views.hwi import hwi_views +from .descriptor import AddChecksum +from .logic import Specter +from .views.hwi import hwi_views env_path = Path('.') / '.flaskenv' load_dotenv(env_path) -DEBUG = True def create_app(): if getattr(sys, 'frozen', False): @@ -34,7 +33,7 @@ def create_app(): app.specter = specter app.register_blueprint(hwi_views, url_prefix='/hwi') with app.app_context(): - import controller + from . import controller return app @@ -49,31 +48,4 @@ SINGLE_TYPES = { "legacy": "P2PKH", "p2sh-segwit": "P2SH_P2WPKH", "bech32": "P2WPKH" -} - - - - -############### startup ################## - -if __name__ == '__main__': - app = create_app() - # watch templates folder to reload when something changes - extra_dirs = ['templates'] - extra_files = extra_dirs[:] - for extra_dir in extra_dirs: - for dirname, dirs, files in os.walk(extra_dir): - for filename in files: - filename = os.path.join(dirname, filename) - if os.path.isfile(filename): - extra_files.append(filename) - - # Note: dotenv doesn't convert bools! - if os.getenv('CONNECT_TOR', 'False') == 'True' and os.getenv('TOR_PASSWORD') is not None: - import tor_util - tor_util.run_on_hidden_service( - app, port=os.getenv('PORT'), - debug=DEBUG, extra_files=extra_files - ) - else: - app.run(port=os.getenv('PORT'), debug=DEBUG, extra_files=extra_files) +} \ No newline at end of file diff --git a/src/specter/static/img/ca.png b/src/cryptoadvance/specter/static/img/ca.png similarity index 100% rename from src/specter/static/img/ca.png rename to src/cryptoadvance/specter/static/img/ca.png diff --git a/src/specter/static/img/coldcard.svg b/src/cryptoadvance/specter/static/img/coldcard.svg similarity index 100% rename from src/specter/static/img/coldcard.svg rename to src/cryptoadvance/specter/static/img/coldcard.svg diff --git a/src/specter/static/img/coldcard_icon.svg b/src/cryptoadvance/specter/static/img/coldcard_icon.svg similarity index 100% rename from src/specter/static/img/coldcard_icon.svg rename to src/cryptoadvance/specter/static/img/coldcard_icon.svg diff --git a/src/specter/static/img/generate_icon.svg b/src/cryptoadvance/specter/static/img/generate_icon.svg similarity index 100% rename from src/specter/static/img/generate_icon.svg rename to src/cryptoadvance/specter/static/img/generate_icon.svg diff --git a/src/specter/static/img/hwi.svg b/src/cryptoadvance/specter/static/img/hwi.svg similarity index 100% rename from src/specter/static/img/hwi.svg rename to src/cryptoadvance/specter/static/img/hwi.svg diff --git a/src/specter/static/img/hwi_icon.svg b/src/cryptoadvance/specter/static/img/hwi_icon.svg similarity index 100% rename from src/specter/static/img/hwi_icon.svg rename to src/cryptoadvance/specter/static/img/hwi_icon.svg diff --git a/src/specter/static/img/icon.png b/src/cryptoadvance/specter/static/img/icon.png similarity index 100% rename from src/specter/static/img/icon.png rename to src/cryptoadvance/specter/static/img/icon.png diff --git a/src/specter/static/img/loader.gif b/src/cryptoadvance/specter/static/img/loader.gif similarity index 100% rename from src/specter/static/img/loader.gif rename to src/cryptoadvance/specter/static/img/loader.gif diff --git a/src/specter/static/img/loader_boxes.svg b/src/cryptoadvance/specter/static/img/loader_boxes.svg similarity index 100% rename from src/specter/static/img/loader_boxes.svg rename to src/cryptoadvance/specter/static/img/loader_boxes.svg diff --git a/src/specter/static/img/multisig_icon.svg b/src/cryptoadvance/specter/static/img/multisig_icon.svg similarity index 100% rename from src/specter/static/img/multisig_icon.svg rename to src/cryptoadvance/specter/static/img/multisig_icon.svg diff --git a/src/specter/static/img/other.svg b/src/cryptoadvance/specter/static/img/other.svg similarity index 100% rename from src/specter/static/img/other.svg rename to src/cryptoadvance/specter/static/img/other.svg diff --git a/src/specter/static/img/other_icon.svg b/src/cryptoadvance/specter/static/img/other_icon.svg similarity index 100% rename from src/specter/static/img/other_icon.svg rename to src/cryptoadvance/specter/static/img/other_icon.svg diff --git a/src/specter/static/img/qr_icon.svg b/src/cryptoadvance/specter/static/img/qr_icon.svg similarity index 100% rename from src/specter/static/img/qr_icon.svg rename to src/cryptoadvance/specter/static/img/qr_icon.svg diff --git a/src/specter/static/img/qr_tiny.svg b/src/cryptoadvance/specter/static/img/qr_tiny.svg similarity index 100% rename from src/specter/static/img/qr_tiny.svg rename to src/cryptoadvance/specter/static/img/qr_tiny.svg diff --git a/src/specter/static/img/receive_icon.svg b/src/cryptoadvance/specter/static/img/receive_icon.svg similarity index 100% rename from src/specter/static/img/receive_icon.svg rename to src/cryptoadvance/specter/static/img/receive_icon.svg diff --git a/src/specter/static/img/send_icon.svg b/src/cryptoadvance/specter/static/img/send_icon.svg similarity index 100% rename from src/specter/static/img/send_icon.svg rename to src/cryptoadvance/specter/static/img/send_icon.svg diff --git a/src/specter/static/img/simple_icon.svg b/src/cryptoadvance/specter/static/img/simple_icon.svg similarity index 100% rename from src/specter/static/img/simple_icon.svg rename to src/cryptoadvance/specter/static/img/simple_icon.svg diff --git a/src/specter/static/img/specter.svg b/src/cryptoadvance/specter/static/img/specter.svg similarity index 100% rename from src/specter/static/img/specter.svg rename to src/cryptoadvance/specter/static/img/specter.svg diff --git a/src/specter/static/img/specter_icon.svg b/src/cryptoadvance/specter/static/img/specter_icon.svg similarity index 100% rename from src/specter/static/img/specter_icon.svg rename to src/cryptoadvance/specter/static/img/specter_icon.svg diff --git a/src/specter/static/img/unconfirmed_receive_icon.svg b/src/cryptoadvance/specter/static/img/unconfirmed_receive_icon.svg similarity index 100% rename from src/specter/static/img/unconfirmed_receive_icon.svg rename to src/cryptoadvance/specter/static/img/unconfirmed_receive_icon.svg diff --git a/src/specter/static/img/unconfirmed_send_icon.svg b/src/cryptoadvance/specter/static/img/unconfirmed_send_icon.svg similarity index 100% rename from src/specter/static/img/unconfirmed_send_icon.svg rename to src/cryptoadvance/specter/static/img/unconfirmed_send_icon.svg diff --git a/src/specter/static/img/usb_tiny.svg b/src/cryptoadvance/specter/static/img/usb_tiny.svg similarity index 100% rename from src/specter/static/img/usb_tiny.svg rename to src/cryptoadvance/specter/static/img/usb_tiny.svg diff --git a/src/specter/static/qr/qr-scanner-worker.min.js b/src/cryptoadvance/specter/static/qr/qr-scanner-worker.min.js similarity index 100% rename from src/specter/static/qr/qr-scanner-worker.min.js rename to src/cryptoadvance/specter/static/qr/qr-scanner-worker.min.js diff --git a/src/specter/static/qr/qr-scanner.min.js b/src/cryptoadvance/specter/static/qr/qr-scanner.min.js similarity index 100% rename from src/specter/static/qr/qr-scanner.min.js rename to src/cryptoadvance/specter/static/qr/qr-scanner.min.js diff --git a/src/specter/static/qr/qr-scanner.min.js.map b/src/cryptoadvance/specter/static/qr/qr-scanner.min.js.map similarity index 100% rename from src/specter/static/qr/qr-scanner.min.js.map rename to src/cryptoadvance/specter/static/qr/qr-scanner.min.js.map diff --git a/src/specter/static/styles.css b/src/cryptoadvance/specter/static/styles.css similarity index 100% rename from src/specter/static/styles.css rename to src/cryptoadvance/specter/static/styles.css diff --git a/src/specter/static/vue.min.js b/src/cryptoadvance/specter/static/vue.min.js similarity index 100% rename from src/specter/static/vue.min.js rename to src/cryptoadvance/specter/static/vue.min.js diff --git a/src/specter/templates/base.html b/src/cryptoadvance/specter/templates/base.html similarity index 100% rename from src/specter/templates/base.html rename to src/cryptoadvance/specter/templates/base.html diff --git a/src/specter/templates/device.html b/src/cryptoadvance/specter/templates/device.html similarity index 100% rename from src/specter/templates/device.html rename to src/cryptoadvance/specter/templates/device.html diff --git a/src/specter/templates/hwi_new_device_xpubs.html b/src/cryptoadvance/specter/templates/hwi_new_device_xpubs.html similarity index 100% rename from src/specter/templates/hwi_new_device_xpubs.html rename to src/cryptoadvance/specter/templates/hwi_new_device_xpubs.html diff --git a/src/specter/templates/includes/hwi.html b/src/cryptoadvance/specter/templates/includes/hwi.html similarity index 100% rename from src/specter/templates/includes/hwi.html rename to src/cryptoadvance/specter/templates/includes/hwi.html diff --git a/src/specter/templates/includes/overlay.html b/src/cryptoadvance/specter/templates/includes/overlay.html similarity index 100% rename from src/specter/templates/includes/overlay.html rename to src/cryptoadvance/specter/templates/includes/overlay.html diff --git a/src/specter/templates/new_device.html b/src/cryptoadvance/specter/templates/new_device.html similarity index 100% rename from src/specter/templates/new_device.html rename to src/cryptoadvance/specter/templates/new_device.html diff --git a/src/specter/templates/new_device_xpubs.html b/src/cryptoadvance/specter/templates/new_device_xpubs.html similarity index 100% rename from src/specter/templates/new_device_xpubs.html rename to src/cryptoadvance/specter/templates/new_device_xpubs.html diff --git a/src/specter/templates/new_simple.html b/src/cryptoadvance/specter/templates/new_simple.html similarity index 100% rename from src/specter/templates/new_simple.html rename to src/cryptoadvance/specter/templates/new_simple.html diff --git a/src/specter/templates/new_simple_keys.html b/src/cryptoadvance/specter/templates/new_simple_keys.html similarity index 100% rename from src/specter/templates/new_simple_keys.html rename to src/cryptoadvance/specter/templates/new_simple_keys.html diff --git a/src/specter/templates/new_wallet.html b/src/cryptoadvance/specter/templates/new_wallet.html similarity index 100% rename from src/specter/templates/new_wallet.html rename to src/cryptoadvance/specter/templates/new_wallet.html diff --git a/src/specter/templates/settings.html b/src/cryptoadvance/specter/templates/settings.html similarity index 100% rename from src/specter/templates/settings.html rename to src/cryptoadvance/specter/templates/settings.html diff --git a/src/specter/templates/wallet_receive.html b/src/cryptoadvance/specter/templates/wallet_receive.html similarity index 100% rename from src/specter/templates/wallet_receive.html rename to src/cryptoadvance/specter/templates/wallet_receive.html diff --git a/src/specter/templates/wallet_send.html b/src/cryptoadvance/specter/templates/wallet_send.html similarity index 100% rename from src/specter/templates/wallet_send.html rename to src/cryptoadvance/specter/templates/wallet_send.html diff --git a/src/specter/templates/wallet_settings.html b/src/cryptoadvance/specter/templates/wallet_settings.html similarity index 100% rename from src/specter/templates/wallet_settings.html rename to src/cryptoadvance/specter/templates/wallet_settings.html diff --git a/src/specter/templates/wallet_tx.html b/src/cryptoadvance/specter/templates/wallet_tx.html similarity index 100% rename from src/specter/templates/wallet_tx.html rename to src/cryptoadvance/specter/templates/wallet_tx.html diff --git a/src/specter/tor_util.py b/src/cryptoadvance/specter/tor_util.py similarity index 100% rename from src/specter/tor_util.py rename to src/cryptoadvance/specter/tor_util.py diff --git a/src/cryptoadvance/specter/views/__init__.py b/src/cryptoadvance/specter/views/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/specter/views/hwi.py b/src/cryptoadvance/specter/views/hwi.py similarity index 99% rename from src/specter/views/hwi.py rename to src/cryptoadvance/specter/views/hwi.py index c493cc3ac..87cb83995 100644 --- a/src/specter/views/hwi.py +++ b/src/cryptoadvance/specter/views/hwi.py @@ -5,7 +5,7 @@ import subprocess import sys from flask import Flask, Blueprint, render_template, request, redirect, jsonify, current_app -from helpers import normalize_xpubs, convert_xpub_prefix, which +from ..helpers import normalize_xpubs, convert_xpub_prefix, which from hwilib import commands as hwilib_commands from hwilib import base58 diff --git a/src/specter/views/specter_hwi.py b/src/cryptoadvance/specter/views/specter_hwi.py similarity index 100% rename from src/specter/views/specter_hwi.py rename to src/cryptoadvance/specter/views/specter_hwi.py diff --git a/tests/conftest.py b/tests/conftest.py index 428fa61fb..f8314a601 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,9 +9,8 @@ import time import pytest import docker -from bitcoind import BitcoindDockerController, BitcoindPlainController - -from logic import Specter, DeviceManager +from cryptoadvance.specter.bitcoind import BitcoindDockerController, BitcoindPlainController +from cryptoadvance.specter.logic import Specter, DeviceManager def pytest_addoption(parser): diff --git a/tests/test_bitcoind.py b/tests/test_bitcoind.py index da34a7061..ef77a8942 100644 --- a/tests/test_bitcoind.py +++ b/tests/test_bitcoind.py @@ -1,9 +1,8 @@ import logging - def test_bitcoinddocker_running(caplog): caplog.set_level(logging.DEBUG) - from bitcoind import BitcoindDockerController + from cryptoadvance.specter.bitcoind import BitcoindDockerController my_bitcoind = BitcoindDockerController(rpcport=18999) # completly different port to not interfere #assert my_bitcoind.detect_bitcoind_container() == True rpcconn = my_bitcoind.start_bitcoind(cleanup_at_exit=True) diff --git a/tests/test_cli.py b/tests/test_cli.py index 8c82d4a55..9c510897b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,4 @@ -from cli import fetch_wallet_addresses_for_mining +from cryptoadvance.specter.bitcoind import fetch_wallet_addresses_for_mining def test_fetch_wallet_addresses_for_mining(wallets_filled_data_folder): # Todo: instantiate a specter-testwallet diff --git a/tests/test_helpers.py b/tests/test_helpers.py index dc7767532..206688a34 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,5 +1,5 @@ def test_load_jsons(): - import helpers + import cryptoadvance.specter.helpers as helpers mydict = helpers.load_jsons("./tests/helpers_testdata") assert mydict["some_jsonfile"]["blub"] == "bla" assert mydict["some_other_jsonfile"]["bla"] == "blub" @@ -18,7 +18,7 @@ def test_load_jsons(): # os.remove(mydict["ID123"]['fullpath']) def test_which(): - import helpers + import cryptoadvance.specter.helpers as helpers try: helpers.which("some_non_existing_binary") assert False, "Whould raise an Exception" diff --git a/tests/test_rpc.py b/tests/test_rpc.py index 115e0454c..1953484da 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -1,6 +1,6 @@ import pytest -from rpc import BitcoinCLI, RpcError +from cryptoadvance.specter.rpc import BitcoinCLI, RpcError def test_BitcoinCli(bitcoin_regtest): brt = bitcoin_regtest # stupid long name diff --git a/tests/test_specter.py b/tests/test_specter.py index df0455f8b..b9adfb20f 100644 --- a/tests/test_specter.py +++ b/tests/test_specter.py @@ -4,8 +4,8 @@ import shutil import pytest -from rpc import RpcError -from logic import (Device, DeviceManager, Specter, Wallet, WalletManager, +from cryptoadvance.specter.rpc import RpcError +from cryptoadvance.specter.logic import (Device, DeviceManager, Specter, Wallet, WalletManager, alias)