mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 04:45:10 +02:00
test: detect OS consistently using platform.system()
This commit is contained in:
@@ -24,6 +24,7 @@ import asyncio
|
||||
from collections import defaultdict
|
||||
from io import BytesIO
|
||||
import logging
|
||||
import platform
|
||||
import struct
|
||||
import sys
|
||||
import threading
|
||||
@@ -592,7 +593,7 @@ class NetworkThread(threading.Thread):
|
||||
|
||||
NetworkThread.listeners = {}
|
||||
NetworkThread.protos = {}
|
||||
if sys.platform == 'win32':
|
||||
if platform.system() == 'Windows':
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
NetworkThread.network_event_loop = asyncio.new_event_loop()
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import http.client
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -19,7 +20,6 @@ import time
|
||||
import urllib.parse
|
||||
import collections
|
||||
import shlex
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from .authproxy import (
|
||||
@@ -567,7 +567,7 @@ class TestNode():
|
||||
cmd, shell=True,
|
||||
stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) == 0
|
||||
|
||||
if not sys.platform.startswith('linux'):
|
||||
if platform.system() != 'Linux':
|
||||
self.log.warning("Can't profile with perf; only available on Linux platforms")
|
||||
return None
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
from . import coverage
|
||||
@@ -414,12 +414,12 @@ def get_temp_default_datadir(temp_dir: pathlib.Path) -> tuple[dict, pathlib.Path
|
||||
"""Return os-specific environment variables that can be set to make the
|
||||
GetDefaultDataDir() function return a datadir path under the provided
|
||||
temp_dir, as well as the complete path it would return."""
|
||||
if sys.platform == "win32":
|
||||
if platform.system() == "Windows":
|
||||
env = dict(APPDATA=str(temp_dir))
|
||||
datadir = temp_dir / "Bitcoin"
|
||||
else:
|
||||
env = dict(HOME=str(temp_dir))
|
||||
if sys.platform == "darwin":
|
||||
if platform.system() == "Darwin":
|
||||
datadir = temp_dir / "Library/Application Support/Bitcoin"
|
||||
else:
|
||||
datadir = temp_dir / ".bitcoin"
|
||||
|
||||
Reference in New Issue
Block a user