Skip to content

Commit

Permalink
setup.cfg: add urls, classifiers; add pylint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mmgen committed Nov 10, 2023
1 parent 00a8ff3 commit 57799d6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Pylint

on: [push]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9","3.10","3.11"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install Ubuntu dependencies
run: sudo apt-get update && sudo apt-get install curl

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install gmpy2 cryptography pynacl ecdsa aiohttp requests pexpect scrypt semantic-version
python3 -m pip install pycryptodomex pysocks
python3 -m pip install --no-deps py_ecc==1.6.0 mypy_extensions==0.4.1
python3 -m pip install pylint
- name: Check the code with pylint static code analyzer
run: |
pylint --errors-only mmgen
pylint --errors-only test
pylint --errors-only --disable=relative-beyond-top-level test/cmdtest_py_d
2 changes: 1 addition & 1 deletion mmgen/data/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.0.dev13
14.0.dev14
4 changes: 2 additions & 2 deletions mmgen/keygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def to_viewkey(self,privkey):
return None

@classmethod
def test_avail(cls,cfg,silent=False):
def get_clsname(cls,cfg,silent=False):
return cls.__name__

backend_data = {
Expand Down Expand Up @@ -119,6 +119,6 @@ def KeyGenerator(cfg,proto,pubkey_type,backend=None,silent=False):
backend_clsname = getattr(
pubkey_type_cls,
backend_id.replace('-','_')
).test_avail(cfg,silent=silent)
).get_clsname(cfg,silent=silent)

return getattr(pubkey_type_cls,backend_clsname)(cfg)
13 changes: 9 additions & 4 deletions mmgen/proto/secp256k1/keygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,29 @@ class backend:
class libsecp256k1(keygen_base):

def __init__(self,cfg):
from .secp256k1 import priv2pub
self.priv2pub = priv2pub
# catch ImportError to satisfy pylint when testing repo with unbuilt secp256k1 extension mod:
try:
from .secp256k1 import priv2pub
self.priv2pub = priv2pub
except ImportError:
from ...util import die
die(3,'libsecp256k1.keygen.backend: you shouldn’t be seeing this')

def to_pubkey(self,privkey):
return PubKey(
s = self.priv2pub( privkey, int(privkey.compressed) ),
compressed = privkey.compressed )

@classmethod
def test_avail(cls,cfg,silent=False):
def get_clsname(cls,cfg,silent=False):
try:
from .secp256k1 import priv2pub
if not priv2pub(bytes.fromhex('deadbeef'*8),1):
from ...util import die
die( 'ExtensionModuleError',
'Unable to execute priv2pub() from secp256k1 extension module' )
return cls.__name__
except Exception as e:
except ImportError as e:
if not silent:
from ...util import ymsg
ymsg(str(e))
Expand Down
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ license = GNU GPL v3
platforms = Linux, Armbian, Raspbian, MS Windows
keywords = file: mmgen/data/keywords
project_urls =
Website = https://mmgen-wallet.cc
Bug Tracker = https://github.com/mmgen/mmgen/issues
Documentation = https://github.com/mmgen/mmgen/wiki
classifiers =
Programming Language :: Python :: 3
Programming Language :: C
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows
Environment :: Console
Topic :: Office/Business :: Financial
Topic :: Security :: Cryptography
Topic :: Software Development :: Libraries :: Python Modules
Development Status :: 5 - Production/Stable

[options]
python_requires = >=3.7
Expand Down

0 comments on commit 57799d6

Please sign in to comment.