From e982f7003ac8e866d53f672f13bf2e2bdfaa4b5c Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 17 May 2026 18:03:36 +0000 Subject: [PATCH] new `machine` global constant --- mmgen/cfg.py | 3 ++- test/daemontest_d/exec.py | 4 ++-- test/include/unit_test.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index 74bf5281..a5a3442c 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -20,7 +20,7 @@ cfg: Configuration classes for the MMGen suite """ -import sys, os +import sys, os, platform from collections import namedtuple from .base_obj import Lockable @@ -92,6 +92,7 @@ class GlobalConstants(Lockable): prog_id = prog_name.removeprefix(f'{proj_id}-') cmd_caps = cmd_caps_data.get(prog_id) + machine = platform.machine() # x86_64, aarch64, armv7l, riscv64, AMD64 (MSYS2) platform = sys.platform # linux, darwin, win32 (MSYS2) if platform not in ('linux', 'win32', 'darwin'): diff --git a/test/daemontest_d/exec.py b/test/daemontest_d/exec.py index 0269e0b0..72c4f000 100755 --- a/test/daemontest_d/exec.py +++ b/test/daemontest_d/exec.py @@ -7,6 +7,7 @@ test.daemontest_d.exec: unit test for the MMGen suite's Daemon class from subprocess import run, PIPE from collections import namedtuple +from mmgen.cfg import gc from mmgen.color import orange, red from mmgen.util import fmt_list, in_nix_environment from mmgen.daemon import CoinDaemon @@ -107,11 +108,10 @@ class unit_tests: def avail(self, name, ut): qmsg_r('Testing availability of coin daemons...') - from platform import machine test_reth = not (cfg.no_altcoin_deps or cfg.fast) test_parity = not ( cfg.no_altcoin_deps - or machine() in ('riscv64', 'aarch64', 'armv7l') + or gc.machine in ('riscv64', 'aarch64', 'armv7l') or in_nix_environment()) ret1 = self._test_cmd( ['start', '--print-version', '--mainnet-only'], diff --git a/test/include/unit_test.py b/test/include/unit_test.py index 8cee35a1..7e67c402 100755 --- a/test/include/unit_test.py +++ b/test/include/unit_test.py @@ -20,7 +20,7 @@ test.include.unit_test: Unit test framework for the MMGen suite """ -import sys, os, time, importlib, platform, asyncio +import sys, os, time, importlib, asyncio from .test_init import repo_root @@ -249,10 +249,10 @@ def run_test(test, subtest=None): if gc.platform == 'darwin' and _subtest in mac_skip: subtest_skip_msg(_subtest, 'for macOS platform') continue - if platform.machine() == 'aarch64' and _subtest in arm_skip: + if gc.machine == 'aarch64' and _subtest in arm_skip: subtest_skip_msg(_subtest, 'for ARM platform') continue - if platform.machine() == 'riscv64' and _subtest in riscv_skip: + if gc.machine == 'riscv64' and _subtest in riscv_skip: subtest_skip_msg(_subtest, 'for RISC-V platform') continue run_subtest(t, _subtest)