Convert from setup.py to pyproject.toml

This commit is contained in:
tecnovert 2024-10-09 22:15:56 +02:00
parent e2fe0697ee
commit 996c67beea
31 changed files with 69 additions and 108 deletions

View file

@ -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

View file

@ -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 *

View file

@ -0,0 +1 @@
name = "bin"

View file

@ -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', '')

View file

@ -1 +0,0 @@
name = "bin"

View file

@ -1 +1 @@
basicswap_prepare.py
../basicswap/bin/prepare.py

View file

@ -1 +1 @@
basicswap_run.py
../basicswap/bin/run.py

View file

@ -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 .

View file

@ -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 .

View file

@ -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; \

View file

@ -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

43
pyproject.toml Normal file
View file

@ -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

View file

@ -5,3 +5,4 @@ python-gnupg
Jinja2
pycryptodome
PySocks
git+https://github.com/basicswap/coincurve@basicswap_v0.2

View file

@ -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",
]
}
)

View file

@ -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

View file

@ -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)

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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']

View file

@ -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'))

View file

@ -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,

View file

@ -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,

View file

@ -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'))

View file

@ -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()

View file

@ -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()