From 0e6ab32bf11a90b92a20db3b40bc7587dc38f5a8 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 19 May 2023 20:29:09 +0000 Subject: [PATCH] setup.py: Windows build fix --- mmgen/data/version | 2 +- setup.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mmgen/data/version b/mmgen/data/version index e4948247..b718e2cf 100644 --- a/mmgen/data/version +++ b/mmgen/data/version @@ -1 +1 @@ -13.3.dev56 +13.3.dev57 diff --git a/setup.py b/setup.py index baddf91f..82aa5906 100755 --- a/setup.py +++ b/setup.py @@ -9,13 +9,28 @@ cache_path = os.path.join(os.environ['HOME'],'.cache','mmgen') ext_path = os.path.join(cache_path,'secp256k1') def build_libsecp256k1(): + + def fix_broken_libpython_fn(): + from pathlib import Path + from_path = Path('C:/msys64/mingw64/lib/libpython3.10.dll.a') + to_path = Path('C:/msys64/mingw64/lib/libpython310.dll.a') + if from_path.exists() and not to_path.exists(): + import shutil + print(f'Fixing broken library filename: {from_path.name!r} -> {to_path.name!r}') + shutil.copy2(from_path,to_path) + + import platform + if platform.system() == 'Windows': + fix_broken_libpython_fn() + if not os.path.exists(cache_path): os.makedirs(cache_path) + if not os.path.exists(ext_path): print('\nCloning libsecp256k1') 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')): - import platform print('\nBuilding libsecp256k1') cmds = { 'Windows': (