Browse Source

setup.cfg: add urls, classifiers; add pylint workflow

The MMGen Project 1 year ago
parent
commit
57799d6977
5 changed files with 56 additions and 7 deletions
  1. 36 0
      .github/workflows/pylint.yaml
  2. 1 1
      mmgen/data/version
  3. 2 2
      mmgen/keygen.py
  4. 9 4
      mmgen/proto/secp256k1/keygen.py
  5. 8 0
      setup.cfg

+ 36 - 0
.github/workflows/pylint.yaml

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

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-14.0.dev13
+14.0.dev14

+ 2 - 2
mmgen/keygen.py

@@ -44,7 +44,7 @@ class keygen_base:
 		return None
 
 	@classmethod
-	def test_avail(cls,cfg,silent=False):
+	def get_clsname(cls,cfg,silent=False):
 		return cls.__name__
 
 backend_data = {
@@ -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)

+ 9 - 4
mmgen/proto/secp256k1/keygen.py

@@ -20,8 +20,13 @@ 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(
@@ -29,7 +34,7 @@ class backend:
 				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):
@@ -37,7 +42,7 @@ class backend:
 					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))

+ 8 - 0
setup.cfg

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