Browse Source

setup.py,setup.cfg: Windows build fixes

The MMGen Project 3 years ago
parent
commit
c82eb9d149
4 changed files with 30 additions and 10 deletions
  1. 3 2
      eth-requirements.txt
  2. 2 2
      pyproject.toml
  3. 9 3
      setup.cfg
  4. 16 3
      setup.py

+ 3 - 2
eth-requirements.txt

@@ -1,4 +1,5 @@
-semantic-version
-pysha3
+# Install with --no-deps.   Otherwise, many unneeded dependencies will be
+# installed.
+
 py_ecc==1.6.0
 mypy_extensions==0.4.1

+ 2 - 2
pyproject.toml

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

+ 9 - 3
setup.cfg

@@ -21,17 +21,23 @@ classifiers  =
 [options]
 python_requires = >=3.7
 include_package_data = True
+
+# pysha3 is used by XMR and ETH for the keccak hash function only.  If the
+# module is not available, the native Python implementation in mmgen.keccak
+# will be used instead.
 install_requires =
+	importlib-resources; python_version < "3.9"
 	gmpy2
 	cryptography
 	pynacl
 	ecdsa
 	requests
-	aiohttp
-	pysocks
+	pysocks # xmrwallet.py
 	pexpect
-	importlib-resources; python_version < "3.9"
 	scrypt
+	semantic-version # scripts/create-token.py
+	aiohttp; platform_system != "Windows"
+	pysha3; platform_system != "Windows"
 
 packages =
 	mmgen

+ 16 - 3
setup.py

@@ -14,9 +14,22 @@ def build_libsecp256k1():
 	if not os.path.exists(ext_path):
 		run(['git','clone','https://github.com/bitcoin-core/secp256k1.git'],check=True,cwd=cache_path)
 	if not os.path.exists(os.path.join(ext_path,'.libs/libsecp256k1.a')):
-		run(['./autogen.sh'],check=True,cwd=ext_path)
-		run(['./configure','CFLAGS=-g -O2 -fPIC'],check=True,cwd=ext_path)
-		run(['make','-j4'],check=True,cwd=ext_path)
+		import platform
+		cmds = {
+			'Windows': (
+				['sh','./autogen.sh'],
+				['sh','./configure','CFLAGS=-g -O2 -fPIC','--disable-dependency-tracking'],
+				['mingw32-make','MAKE=mingw32-make','LIBTOOL=/mingw64/bin/libtool']
+			),
+			'Linux': (
+				['./autogen.sh'],
+				['./configure','CFLAGS=-g -O2 -fPIC'],
+				['make','-j4']
+			),
+		}[platform.system()]
+		for cmd in cmds:
+			print('Executing {}'.format(' '.join(cmd)))
+			run(cmd,check=True,cwd=ext_path)
 
 have_msys2 = run(['uname','-s'],stdout=PIPE,check=True).stdout.startswith(b'MSYS_NT')
 if have_msys2: