setuptools: migrate from setup.py to setup.cfg

The preferred way to install MMGen is now:

    # cd to repository root
    $ python3 -m build --no-isolation
    $ pip3 install --user dist/*.whl

A user install eliminates reliance on superuser privileges and prevents
conflicts with Python packages that may already be installed on the system.

Python dependencies are automatically installed by pip.
This commit is contained in:
The MMGen Project 2021-09-23 21:15:33 +00:00
commit 4a9571424e
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 91 additions and 206 deletions

4
eth-requirements.txt Normal file
View file

@ -0,0 +1,4 @@
semantic-version
pysha3
py_ecc==1.6.0
mypy_extensions==0.4.1

1
mmgen/data/keywords Normal file
View file

@ -0,0 +1 @@
Bitcoin, BTC, Ethereum, ETH, Monero, XMR, ERC20, cryptocurrency, wallet, BIP32, cold storage, offline, online, spending, open-source, command-line, Python, Linux, Bitcoin Core, bitcoind, hd, deterministic, hierarchical, secure, anonymous, Electrum, seed, mnemonic, brainwallet, Scrypt, utility, script, scriptable, blockchain, raw, transaction, permissionless, console, terminal, curses, ansi, color, tmux, remote, client, daemon, RPC, json, entropy, xterm, rxvt, PowerShell, MSYS, MSYS2, MinGW, MinGW64, MSWin, Armbian, Raspbian, Raspberry Pi, Orange Pi, BCash, BCH, Litecoin, LTC, altcoin, ZEC, Zcash, DASH, Dashpay, SHA256Compress, monerod, EMC, Emercoin, token, deploy, contract, gas, fee, smart contract, solidity, Parity, OpenEthereum, testnet, devmode, Kovan

1
mmgen/data/release_date Normal file
View file

@ -0,0 +1 @@
February 2021

1
mmgen/data/version Normal file
View file

@ -0,0 +1 @@
0.12.199

View file

@ -46,8 +46,6 @@ class GlobalContext(Lockable):
_use_class_attr = True
# Constants:
version = '0.12.199'
release_date = 'February 2021'
proj_name = 'MMGen'
proj_url = 'https://github.com/mmgen/mmgen'
@ -55,7 +53,15 @@ class GlobalContext(Lockable):
author = 'The MMGen Project'
email = '<mmgen@tuta.io>'
Cdates = '2013-2021'
keywords = 'Bitcoin, BTC, Ethereum, ETH, Monero, XMR, ERC20, cryptocurrency, wallet, BIP32, cold storage, offline, online, spending, open-source, command-line, Python, Linux, Bitcoin Core, bitcoind, hd, deterministic, hierarchical, secure, anonymous, Electrum, seed, mnemonic, brainwallet, Scrypt, utility, script, scriptable, blockchain, raw, transaction, permissionless, console, terminal, curses, ansi, color, tmux, remote, client, daemon, RPC, json, entropy, xterm, rxvt, PowerShell, MSYS, MSYS2, MinGW, MinGW64, MSWin, Armbian, Raspbian, Raspberry Pi, Orange Pi, BCash, BCH, Litecoin, LTC, altcoin, ZEC, Zcash, DASH, Dashpay, SHA256Compress, monerod, EMC, Emercoin, token, deploy, contract, gas, fee, smart contract, solidity, Parity, OpenEthereum, testnet, devmode, Kovan'
try:
from importlib.resources import files # Python 3.9
except ImportError:
from importlib_resources import files
version = files('mmgen').joinpath('data','version').read_text().strip()
release_date = files('mmgen').joinpath('data','release_date').read_text().strip()
max_int = 0xffffffff
stdin_tty = sys.stdin.isatty()

7
pyproject.toml Normal file
View file

@ -0,0 +1,7 @@
[build-system]
requires = [
"setuptools>=57",
"wheel>=0.37.0",
"build>=0.7.0",
]
build-backend = "setuptools.build_meta"

65
setup.cfg Normal file
View file

@ -0,0 +1,65 @@
[metadata]
name = MMGen
version = file: mmgen/data/version
description = MMGen cryptocurrency wallet suite
long_description = file: README.md
long_description_content_type = text/markdown
author = The MMGen Project
author_email = mmgen@tuta.io
url = https://github.com/mmgen/mmgen
license = GNU GPL v3
platforms = Linux, Armbian, Raspbian, MS Windows
keywords = file: mmgen/data/keywords
project_urls =
Bug Tracker = https://github.com/mmgen/mmgen/issues
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows
[options]
python_requires = >=3.7
include_package_data = True
install_requires =
gmpy2
cryptography
pynacl
ecdsa
requests
aiohttp
pysocks
pexpect
importlib-resources; python_version < "3.9"
scrypt
packages =
mmgen
mmgen.share
mmgen.altcoins
mmgen.altcoins.eth
mmgen.altcoins.eth.pyethereum
mmgen.altcoins.eth.rlp
scripts =
cmds/mmgen-addrgen
cmds/mmgen-addrimport
cmds/mmgen-autosign
cmds/mmgen-keygen
cmds/mmgen-passchg
cmds/mmgen-passgen
cmds/mmgen-regtest
cmds/mmgen-seedjoin
cmds/mmgen-seedsplit
cmds/mmgen-split
cmds/mmgen-subwalletgen
cmds/mmgen-tool
cmds/mmgen-txbump
cmds/mmgen-txcreate
cmds/mmgen-txdo
cmds/mmgen-txsend
cmds/mmgen-txsign
cmds/mmgen-walletchk
cmds/mmgen-walletconv
cmds/mmgen-walletgen
cmds/mmgen-xmrwallet

206
setup.py
View file

@ -1,216 +1,16 @@
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
# Copyright (C)2013-2021 The MMGen Project <mmgen@tuta.io>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys,os
from setuptools import setup,Extension
from subprocess import run,PIPE
from shutil import copy2
sys_ver = sys.version_info[:2]
req_ver = (3,7)
ver2f = lambda t: float('{}.{:03}'.format(*t))
if ver2f(sys_ver) < ver2f(req_ver):
m = '{}.{}: unsupported Python version. MMGen requires Python {}.{} or greater\n'
sys.stderr.write(m.format(*sys_ver,*req_ver))
sys.exit(1)
have_msys2 = run(['uname','-s'],stdout=PIPE,check=True).stdout.startswith(b'MSYS_NT')
if have_msys2:
print('MSYS2 system detected')
from setuptools import setup,Extension
from setuptools.command.install import install
from setuptools.command.build_py import build_py
from setuptools.command.build_ext import build_ext
cwd = os.getcwd()
def copy_owner(a,b):
st = os.stat(a)
try: os.chown(b,st.st_uid,st.st_gid,follow_symlinks=False)
except: pass
# install extension module in repository after building
class my_build_ext(build_ext):
def build_extension(self,ext):
build_ext.build_extension(self,ext)
ext_src = self.get_ext_fullpath(ext.name)
ext_dest = os.path.join('mmgen',os.path.basename(ext_src))
try: os.unlink(ext_dest)
except: pass
os.chmod(ext_src,0o755) # required if user has non-standard umask
print('copying {} to {}'.format(ext_src,ext_dest))
copy2(ext_src,ext_dest)
copy_owner(cwd,ext_dest)
def link_or_copy(tdir,a,b):
os.chdir(tdir)
try: os.unlink(b)
except FileNotFoundError: pass
copy2(a,b) if have_msys2 else os.symlink(a,b)
copy_owner(a,b)
os.chdir(cwd)
class my_build_py(build_py):
def run(self):
link_or_copy('test','start-coin-daemons.py','stop-coin-daemons.py')
build_py.run(self)
module1 = Extension(
setup(ext_modules=[Extension(
name = 'mmgen.secp256k1',
sources = ['extmod/secp256k1mod.c'],
libraries = ['secp256k1'] + ([],['gmp'])[have_msys2],
library_dirs = ['/usr/local/lib',r'C:\msys64\mingw64\lib',r'C:\msys64\usr\lib'],
include_dirs = ['/usr/local/include',r'C:\msys64\mingw64\include',r'C:\msys64\usr\include'],
)
os.umask(0o0022)
from mmgen.globalvars import g
setup(
name = 'mmgen',
description = 'A complete Bitcoin offline/online wallet solution for the command line',
version = g.version,
author = g.author,
author_email = g.email,
maintainer = g.author,
url = g.proj_url,
license = 'GNU GPL v3',
platforms = 'Linux, Debian, Ubuntu, Arch Linux, MS Windows, Raspberry Pi/Raspbian, Orange Pi/Armbian, Rock Pi/Armbian',
keywords = g.keywords,
cmdclass = {
'build_py': my_build_py,
'build_ext': my_build_ext,
},
ext_modules = [module1],
packages = ['mmgen'],
include_package_data = True,
py_modules = [
'mmgen.__init__',
'mmgen.addr',
'mmgen.altcoin',
'mmgen.baseconv',
'mmgen.base_obj',
'mmgen.bech32',
'mmgen.bip39',
'mmgen.cfg',
'mmgen.color',
'mmgen.common',
'mmgen.crypto',
'mmgen.daemon',
'mmgen.devtools',
'mmgen.ed25519',
'mmgen.ed25519ll_djbec',
'mmgen.exception',
'mmgen.filename',
'mmgen.flags',
'mmgen.globalvars',
'mmgen.help',
'mmgen.keccak',
'mmgen.led',
'mmgen.license',
'mmgen.mn_electrum',
'mmgen.mn_entry',
'mmgen.mn_monero',
'mmgen.mn_tirosh',
'mmgen.obj',
'mmgen.opts',
'mmgen.protocol',
'mmgen.regtest',
'mmgen.rpc',
'mmgen.seed',
'mmgen.sha2',
'mmgen.term',
'mmgen.tool',
'mmgen.tw',
'mmgen.tx',
'mmgen.txfile',
'mmgen.txsign',
'mmgen.util',
'mmgen.wallet',
'mmgen.xmrwallet',
'mmgen.altcoins.__init__',
'mmgen.altcoins.eth.__init__',
'mmgen.altcoins.eth.contract',
'mmgen.altcoins.eth.obj',
'mmgen.altcoins.eth.tx',
'mmgen.altcoins.eth.tw',
'mmgen.altcoins.eth.pyethereum.__init__',
'mmgen.altcoins.eth.pyethereum.transactions',
'mmgen.altcoins.eth.pyethereum.utils',
'mmgen.altcoins.eth.rlp.__init__',
'mmgen.altcoins.eth.rlp.atomic',
'mmgen.altcoins.eth.rlp.codec',
'mmgen.altcoins.eth.rlp.exceptions',
'mmgen.altcoins.eth.rlp.sedes.__init__',
'mmgen.altcoins.eth.rlp.sedes.big_endian_int',
'mmgen.altcoins.eth.rlp.sedes.binary',
'mmgen.altcoins.eth.rlp.sedes.boolean',
'mmgen.altcoins.eth.rlp.sedes.lists',
'mmgen.altcoins.eth.rlp.sedes.raw',
'mmgen.altcoins.eth.rlp.sedes.serializable',
'mmgen.altcoins.eth.rlp.sedes.text',
'mmgen.main',
'mmgen.main_addrgen',
'mmgen.main_addrimport',
'mmgen.main_autosign',
'mmgen.main_passgen',
'mmgen.main_regtest',
'mmgen.main_seedjoin',
'mmgen.main_split',
'mmgen.main_tool',
'mmgen.main_txbump',
'mmgen.main_txcreate',
'mmgen.main_txdo',
'mmgen.main_txsend',
'mmgen.main_txsign',
'mmgen.main_wallet',
'mmgen.main_xmrwallet',
'mmgen.share.__init__',
'mmgen.share.Opts',
],
scripts = [
'cmds/mmgen-addrgen',
'cmds/mmgen-addrimport',
'cmds/mmgen-autosign',
'cmds/mmgen-keygen',
'cmds/mmgen-passchg',
'cmds/mmgen-passgen',
'cmds/mmgen-regtest',
'cmds/mmgen-seedjoin',
'cmds/mmgen-seedsplit',
'cmds/mmgen-split',
'cmds/mmgen-subwalletgen',
'cmds/mmgen-tool',
'cmds/mmgen-txbump',
'cmds/mmgen-txcreate',
'cmds/mmgen-txdo',
'cmds/mmgen-txsend',
'cmds/mmgen-txsign',
'cmds/mmgen-walletchk',
'cmds/mmgen-walletconv',
'cmds/mmgen-walletgen',
'cmds/mmgen-xmrwallet',
]
)
)])