diff --git a/Dockerfile b/Dockerfile index 60ff930..b92341b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,6 @@ ENV LANG=C.UTF-8 \ RUN apt-get update; \ apt-get install -y git python3-pip gnupg make g++ autoconf automake libtool pkg-config gosu tzdata; -ARG COINCURVE_VERSION=v0.2 -RUN git clone https://github.com/basicswap/coincurve.git -b basicswap_$COINCURVE_VERSION coincurve-basicswap && \ - cd coincurve-basicswap && \ - pip install . - # Install requirements first so as to skip in subsequent rebuilds COPY ./requirements.txt requirements.txt RUN pip3 install -r requirements.txt diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 571ecd4..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.md LICENSE - -recursive-include doc * -recursive-include pgp * -recursive-include basicswap/templates * -recursive-include basicswap/static * -recursive-include basicswap/contrib/mnemonic/wordlist * diff --git a/basicswap/bin/__init__.py b/basicswap/bin/__init__.py new file mode 100644 index 0000000..9f6f3e6 --- /dev/null +++ b/basicswap/bin/__init__.py @@ -0,0 +1 @@ +name = "bin" diff --git a/bin/basicswap_prepare.py b/basicswap/bin/prepare.py similarity index 99% rename from bin/basicswap_prepare.py rename to basicswap/bin/prepare.py index 2227cad..0c79ed7 100755 --- a/bin/basicswap_prepare.py +++ b/basicswap/bin/prepare.py @@ -37,7 +37,7 @@ from basicswap.ui.util import getCoinName from basicswap.util import toBool from basicswap.util.network import urlretrieve, make_reporthook from basicswap.util.rfc2440 import rfc2440_hash_password -from bin.basicswap_run import startDaemon, startXmrWalletDaemon +from basicswap.bin.run import startDaemon, startXmrWalletDaemon PARTICL_VERSION = os.getenv('PARTICL_VERSION', '23.2.7.0') PARTICL_VERSION_TAG = os.getenv('PARTICL_VERSION_TAG', '') diff --git a/bin/basicswap_run.py b/basicswap/bin/run.py similarity index 100% rename from bin/basicswap_run.py rename to basicswap/bin/run.py diff --git a/bin/__init__.py b/bin/__init__.py index 9f6f3e6..e69de29 100644 --- a/bin/__init__.py +++ b/bin/__init__.py @@ -1 +0,0 @@ -name = "bin" diff --git a/bin/basicswap-prepare.py b/bin/basicswap-prepare.py index 3e1214f..45abbf7 120000 --- a/bin/basicswap-prepare.py +++ b/bin/basicswap-prepare.py @@ -1 +1 @@ -basicswap_prepare.py \ No newline at end of file +../basicswap/bin/prepare.py \ No newline at end of file diff --git a/bin/basicswap-run.py b/bin/basicswap-run.py index 0bf5b17..2e7d6fa 120000 --- a/bin/basicswap-run.py +++ b/bin/basicswap-run.py @@ -1 +1 @@ -basicswap_run.py \ No newline at end of file +../basicswap/bin/run.py \ No newline at end of file diff --git a/doc/install.md b/doc/install.md index c53aa79..3a0e922 100644 --- a/doc/install.md +++ b/doc/install.md @@ -160,11 +160,6 @@ Close the terminal and open a new one to update the python symlinks. export SWAP_DATADIR=$HOME/coinswaps python3 -m venv "$SWAP_DATADIR/venv" . $SWAP_DATADIR/venv/bin/activate && python -V - cd $SWAP_DATADIR - git clone https://github.com/basicswap/coincurve.git -b basicswap_v0.2 coincurve-basicswap - cd $SWAP_DATADIR/coincurve-basicswap - pip3 install . - cd $SWAP_DATADIR git clone https://github.com/basicswap/basicswap.git @@ -179,7 +174,6 @@ From https://pypi.org/project/certifi/ Continue installing Basicswap - pip3 install wheel pip3 install . diff --git a/doc/notes.md b/doc/notes.md index aa5a906..ba726c1 100644 --- a/doc/notes.md +++ b/doc/notes.md @@ -91,19 +91,10 @@ Create and activate a venv python -m venv c:\bsx_venv c:/bsx_venv/scripts/activate - -Install coincurve - - git clone https://github.com/basicswap/coincurve.git -b basicswap_v0.2 coincurve-basicswap - cd coincurve-basicswap - pip3 install . - - Install basicswap git clone https://github.com/basicswap/basicswap.git cd basicswap - pip3 install wheel pip3 install . diff --git a/docker/production/swapclient/Dockerfile b/docker/production/swapclient/Dockerfile index 133e0e5..f25158f 100644 --- a/docker/production/swapclient/Dockerfile +++ b/docker/production/swapclient/Dockerfile @@ -7,13 +7,6 @@ ENV LANG=C.UTF-8 \ RUN apt-get update; \ apt-get install -y wget python3-pip gnupg unzip make g++ autoconf automake libtool pkg-config gosu tzdata; -ARG COINCURVE_VERSION=v0.2 -RUN wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_$COINCURVE_VERSION.zip && \ - unzip coincurve-anonswap.zip && \ - mv ./coincurve-anonswap_$COINCURVE_VERSION ./coincurve-anonswap && \ - cd coincurve-anonswap && \ - python3 setup.py install --force - ARG BASICSWAP_URL=https://github.com/basicswap/basicswap/archive/master.zip ARG BASICSWAP_DIR=basicswap-master RUN wget -O basicswap-repo.zip $BASICSWAP_URL; \ diff --git a/guix.scm b/guix.scm index 5f06d02..08868a9 100644 --- a/guix.scm +++ b/guix.scm @@ -143,7 +143,7 @@ #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-env (lambda* (#:key inputs #:allow-other-keys) - (substitute* "bin/basicswap_prepare.py" + (substitute* "basicswap/bin/prepare.py" (("GUIX_SSL_CERT_DIR = None") (string-append "GUIX_SSL_CERT_DIR = \"" (search-input-directory inputs "etc/ssl/certs") "\"")))))))) (propagated-inputs diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6c0570a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "basicswap" +description = "Simple atomic swap system" +keywords = ["crypto", "cryptocurrency", "particl", "bitcoin", "monero", "wownero"] +readme = "README.md" +license = {file = "LICENSE"} +requires-python = ">=3.8" +dependencies = [ + "wheel", + "pyzmq", + "sqlalchemy==1.4.39", + "python-gnupg", + "Jinja2", + "pycryptodome", + "PySocks", + "coincurve@git+https://github.com/basicswap/coincurve@basicswap_v0.2" +] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Topic :: Security :: Cryptography", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://basicswapdex.com" +Source = "https://github.com/basicswap/basicswap" + +[project.scripts] +basicswap-prepare = "basicswap.bin.prepare:main" +basicswap-run = "basicswap.bin.run:main" + + +[tool.hatch.version] +path = "basicswap/__init__.py" + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/requirements.txt b/requirements.txt index d92ecec..6f7133a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ python-gnupg Jinja2 pycryptodome PySocks +git+https://github.com/basicswap/coincurve@basicswap_v0.2 diff --git a/setup.py b/setup.py deleted file mode 100644 index 1500590..0000000 --- a/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -import setuptools -import re -import io - -__version__ = re.search( - r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', - io.open('basicswap/__init__.py', encoding='utf_8_sig').read() -).group(1) - -setuptools.setup( - name="basicswap", - version=__version__, - author="tecnovert", - author_email="tecnovert@tecnovert.net", - description="Simple atomic swap system", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - url="https://github.com/basicswap/basicswap", - packages=setuptools.find_packages(), - include_package_data=True, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: Linux", - ], - keywords=[ - "crypto", - "cryptocurrency", - "particl", - "bitcoin", - "monero", - "wownero", - ], - install_requires=[ - "wheel", - "pyzmq", - "sqlalchemy==1.4.39", - "python-gnupg", - "Jinja2", - "pycryptodome", - "PySocks", - ], - entry_points={ - "console_scripts": [ - "basicswap-run=bin.basicswap_run:main", - "basicswap-prepare=bin.basicswap_prepare:main", - ] - } -) diff --git a/tests/basicswap/common.py b/tests/basicswap/common.py index eb7a930..d4a17c3 100644 --- a/tests/basicswap/common.py +++ b/tests/basicswap/common.py @@ -14,7 +14,7 @@ from urllib.request import urlopen from .util import read_json_api from basicswap.rpc import callrpc from basicswap.contrib.rpcauth import generate_salt, password_to_hmac -from bin.basicswap_prepare import downloadPIVXParams +from basicswap.bin.prepare import downloadPIVXParams TEST_HTTP_HOST = os.getenv('TEST_HTTP_HOST', '127.0.0.1') # Set to 0.0.0.0 when used in docker diff --git a/tests/basicswap/common_xmr.py b/tests/basicswap/common_xmr.py index 3b57f16..da5c0ea 100644 --- a/tests/basicswap/common_xmr.py +++ b/tests/basicswap/common_xmr.py @@ -35,7 +35,7 @@ from tests.basicswap.common import ( from basicswap.contrib.rpcauth import generate_salt, password_to_hmac import basicswap.config as cfg -import bin.basicswap_run as runSystem +import basicswap.bin.run as runSystem TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1')) @@ -104,7 +104,7 @@ def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None, os.environ['DCR_RPC_PWD'] = 'dcr_pwd' - import bin.basicswap_prepare as prepareSystem + import basicswap.bin.prepare as prepareSystem # Hack: Reload module to set env vars as the basicswap_prepare module is initialised if imported from elsewhere earlier from importlib import reload prepareSystem = reload(prepareSystem) diff --git a/tests/basicswap/extended/test_dash.py b/tests/basicswap/extended/test_dash.py index b184e14..8f7e95b 100644 --- a/tests/basicswap/extended/test_dash.py +++ b/tests/basicswap/extended/test_dash.py @@ -68,7 +68,7 @@ from tests.basicswap.common import ( PREFIX_SECRET_KEY_REGTEST, waitForRPC, ) -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon logger = logging.getLogger() diff --git a/tests/basicswap/extended/test_dcr.py b/tests/basicswap/extended/test_dcr.py index d5512d6..4e37a9c 100644 --- a/tests/basicswap/extended/test_dcr.py +++ b/tests/basicswap/extended/test_dcr.py @@ -55,7 +55,7 @@ from tests.basicswap.test_xmr import BaseTest, test_delay_event from basicswap.interface.dcr import DCRInterface from basicswap.interface.dcr.messages import CTransaction, CTxIn, COutPoint from basicswap.interface.dcr.script import OP_CHECKSEQUENCEVERIFY, push_script_data -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon logger = logging.getLogger() diff --git a/tests/basicswap/extended/test_firo.py b/tests/basicswap/extended/test_firo.py index 8c6dddb..a01eb71 100644 --- a/tests/basicswap/extended/test_firo.py +++ b/tests/basicswap/extended/test_firo.py @@ -43,7 +43,7 @@ from basicswap.interface.contrib.firo_test_framework.mininode import ( CTransaction, set_regtest, ) -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon from basicswap.contrib.rpcauth import generate_salt, password_to_hmac from tests.basicswap.test_xmr import BaseTest, test_delay_event, callnoderpc diff --git a/tests/basicswap/extended/test_nav.py b/tests/basicswap/extended/test_nav.py index a2aebcd..7364f94 100644 --- a/tests/basicswap/extended/test_nav.py +++ b/tests/basicswap/extended/test_nav.py @@ -58,7 +58,7 @@ from basicswap.interface.contrib.nav_test_framework.script import ( OP_CHECKSEQUENCEVERIFY ) -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon from basicswap.contrib.rpcauth import generate_salt, password_to_hmac from tests.basicswap.test_xmr import test_delay_event, callnoderpc from basicswap.contrib.mnemonic import Mnemonic diff --git a/tests/basicswap/extended/test_network.py b/tests/basicswap/extended/test_network.py index cd4c2db..5465dec 100644 --- a/tests/basicswap/extended/test_network.py +++ b/tests/basicswap/extended/test_network.py @@ -58,7 +58,7 @@ from tests.basicswap.common import ( waitForRPC, ) -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon logger = logging.getLogger() diff --git a/tests/basicswap/extended/test_nmc.py b/tests/basicswap/extended/test_nmc.py index 664d447..104620e 100644 --- a/tests/basicswap/extended/test_nmc.py +++ b/tests/basicswap/extended/test_nmc.py @@ -64,7 +64,7 @@ from tests.basicswap.common import ( PREFIX_SECRET_KEY_REGTEST, waitForRPC, ) -from bin.basicswap_run import startDaemon +from basicswap.bin.run import startDaemon logger = logging.getLogger() diff --git a/tests/basicswap/extended/test_pivx.py b/tests/basicswap/extended/test_pivx.py index ff07c67..690a664 100644 --- a/tests/basicswap/extended/test_pivx.py +++ b/tests/basicswap/extended/test_pivx.py @@ -68,8 +68,8 @@ from tests.basicswap.common import ( PREFIX_SECRET_KEY_REGTEST, waitForRPC, ) -from bin.basicswap_run import startDaemon -from bin.basicswap_prepare import downloadPIVXParams +from basicswap.bin.run import startDaemon +from basicswap.bin.prepare import downloadPIVXParams logger = logging.getLogger() diff --git a/tests/basicswap/extended/test_prepare.py b/tests/basicswap/extended/test_prepare.py index 2e9dc0c..26f3562 100644 --- a/tests/basicswap/extended/test_prepare.py +++ b/tests/basicswap/extended/test_prepare.py @@ -39,7 +39,7 @@ def start_prepare(args, env_pairs=[]): for pair in env_pairs: os.environ[pair[0]] = pair[1] print(pair[0], os.environ[pair[0]]) - import bin.basicswap_prepare as prepareSystemThread + import basicswap.bin.prepare as prepareSystemThread with patch.object(sys, 'argv', args): prepareSystemThread.main() del prepareSystemThread @@ -49,7 +49,7 @@ def start_run(args, env_pairs=[]): for pair in env_pairs: os.environ[pair[0]] = pair[1] print(pair[0], os.environ[pair[0]]) - import bin.basicswap_run as runSystemThread + import basicswap.bin.run as runSystemThread with patch.object(sys, 'argv', args): runSystemThread.main() del runSystemThread @@ -81,7 +81,7 @@ class Test(unittest.TestCase): config_path = os.path.join(test_path_plain, cfg.CONFIG_FILENAME) self.assertTrue(os.path.exists(config_path)) - import bin.basicswap_prepare as prepareSystem + import basicswap.bin.prepare as prepareSystem try: logging.info('Test no overwrite') testargs = ['basicswap-prepare', '-datadir=' + test_path_plain, '-withcoin=litecoin'] diff --git a/tests/basicswap/extended/test_wallet_init.py b/tests/basicswap/extended/test_wallet_init.py index 5c0b13e..8dd1b85 100644 --- a/tests/basicswap/extended/test_wallet_init.py +++ b/tests/basicswap/extended/test_wallet_init.py @@ -34,7 +34,7 @@ from tests.basicswap.util import ( from tests.basicswap.common_xmr import ( run_prepare, ) -import bin.basicswap_run as runSystem +import basicswap.bin.run as runSystem TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1')) diff --git a/tests/basicswap/extended/test_wallet_restore.py b/tests/basicswap/extended/test_wallet_restore.py index fc923c0..7640a9f 100644 --- a/tests/basicswap/extended/test_wallet_restore.py +++ b/tests/basicswap/extended/test_wallet_restore.py @@ -44,7 +44,7 @@ from basicswap.rpc import ( callrpc, ) from tests.basicswap.mnemonics import mnemonics -import bin.basicswap_run as runSystem +import basicswap.bin.run as runSystem from tests.basicswap.common import ( BTC_BASE_RPC_PORT, LTC_BASE_RPC_PORT, diff --git a/tests/basicswap/extended/test_wow.py b/tests/basicswap/extended/test_wow.py index f0c3d00..c260b5b 100644 --- a/tests/basicswap/extended/test_wow.py +++ b/tests/basicswap/extended/test_wow.py @@ -20,7 +20,7 @@ from tests.basicswap.common import ( stopDaemons, ) from tests.basicswap.test_xmr import BaseTest -from bin.basicswap_run import startXmrDaemon, startXmrWalletDaemon +from basicswap.bin.run import startXmrDaemon, startXmrWalletDaemon from tests.basicswap.extended.test_dcr import ( run_test_ads_success_path, diff --git a/tests/basicswap/extended/test_xmr_persistent.py b/tests/basicswap/extended/test_xmr_persistent.py index 0246c45..ac3642f 100644 --- a/tests/basicswap/extended/test_xmr_persistent.py +++ b/tests/basicswap/extended/test_xmr_persistent.py @@ -50,7 +50,7 @@ from tests.basicswap.common_xmr import ( XMR_BASE_RPC_PORT, ) from basicswap.interface.dcr.rpc import callrpc as callrpc_dcr -import bin.basicswap_run as runSystem +import basicswap.bin.run as runSystem test_path = os.path.expanduser(os.getenv('TEST_PATH', '/tmp/test_persistent')) diff --git a/tests/basicswap/test_reload.py b/tests/basicswap/test_reload.py index 25a0b30..20f694b 100644 --- a/tests/basicswap/test_reload.py +++ b/tests/basicswap/test_reload.py @@ -39,7 +39,7 @@ from tests.basicswap.common import ( from tests.basicswap.common_xmr import ( prepare_nodes, ) -import bin.basicswap_run as runSystem +import basicswap.bin.run as runSystem TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1')) delay_event = threading.Event() diff --git a/tests/basicswap/test_xmr.py b/tests/basicswap/test_xmr.py index e7123f9..53e72ae 100644 --- a/tests/basicswap/test_xmr.py +++ b/tests/basicswap/test_xmr.py @@ -91,7 +91,7 @@ from tests.basicswap.common import ( from basicswap.db_util import ( remove_expired_data, ) -from bin.basicswap_run import startDaemon, startXmrDaemon, startXmrWalletDaemon +from basicswap.bin.run import startDaemon, startXmrDaemon, startXmrWalletDaemon logger = logging.getLogger()