Skip to content

Commit 127c7fe

Browse files
authored
Merge pull request #1169 from HathorNetwork/chore/remove-windows-support
chore: remove the limited support there was for Windows
2 parents 550767b + 4200cc2 commit 127c7fe

File tree

11 files changed

+15
-38
lines changed

11 files changed

+15
-38
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
full_matrix = {
2626
'python': ['3.10', '3.11', '3.12'],
2727
# available OS's: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
28-
'os': ['ubuntu-22.04', 'macos-12', 'windows-2022'],
28+
'os': ['ubuntu-22.04', 'macos-12'],
2929
}
3030
# this is the fastest one:
3131
reduced_matrix = {

hathor/cli/main.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(self) -> None:
5858
shell,
5959
side_dag,
6060
stratum_mining,
61+
top,
6162
twin_tx,
6263
tx_generator,
6364
wallet,
@@ -70,9 +71,7 @@ def __init__(self) -> None:
7071
self.add_cmd('mining', 'run_stratum_miner', stratum_mining, 'Run a mining process (running node required)')
7172
self.add_cmd('hathor', 'run_node', run_node, 'Run a node')
7273
self.add_cmd('hathor', 'gen_peer_id', peer_id, 'Generate a new random peer-id')
73-
if sys.platform != 'win32':
74-
from . import top
75-
self.add_cmd('hathor', 'top', top, 'CPU profiler viewer')
74+
self.add_cmd('hathor', 'top', top, 'CPU profiler viewer')
7675
self.add_cmd('side-dag', 'run_node_with_side_dag', side_dag, 'Run a side-dag')
7776
self.add_cmd('side-dag', 'gen_poa_keys', generate_poa_keys, 'Generate a private/public key pair and its '
7877
'address to be used in Proof-of-Authority')

hathor/cli/run_node.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,21 @@ def create_parser(cls) -> ArgumentParser:
165165
return parser
166166

167167
def prepare(self, *, register_resources: bool = True) -> None:
168+
import resource
169+
168170
from setproctitle import setproctitle
171+
169172
setproctitle('{}hathor-core'.format(self._args.procname_prefix))
170173

171174
if self._args.recursion_limit:
172175
sys.setrecursionlimit(self._args.recursion_limit)
173176
else:
174177
sys.setrecursionlimit(5000)
175178

176-
if sys.platform != 'win32':
177-
import resource
178-
(nofile_soft, _) = resource.getrlimit(resource.RLIMIT_NOFILE)
179-
if nofile_soft < 256:
180-
print('Maximum number of open file descriptors is too low. Minimum required is 256.')
181-
sys.exit(-2)
179+
(nofile_soft, _) = resource.getrlimit(resource.RLIMIT_NOFILE)
180+
if nofile_soft < 256:
181+
print('Maximum number of open file descriptors is too low. Minimum required is 256.')
182+
sys.exit(-2)
182183

183184
self.check_unsafe_arguments()
184185
self.check_python_version()

hathor/cli/top.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
from math import floor
2525
from typing import Any, Callable, Optional
2626

27-
# XXX: as annoying as it is, a simple `if: raise` is not enough, but putting the whole module inside works
28-
if sys.platform != 'win32':
27+
# XXX: support for Windows removed, this should be un-indented
28+
if True:
2929
import curses
3030
import curses.ascii
3131

hathor/reactor/reactor.py

-5
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,10 @@ def initialize_global_reactor(*, use_asyncio_reactor: bool = False) -> ReactorPr
5555

5656
if use_asyncio_reactor:
5757
import asyncio
58-
import sys
5958

6059
from twisted.internet import asyncioreactor
6160
from twisted.internet.error import ReactorAlreadyInstalledError
6261

63-
if sys.platform == 'win32':
64-
# See: https://docs.twistedmatrix.com/en/twisted-22.10.0/api/twisted.internet.asyncioreactor.AsyncioSelectorReactor.html # noqa: E501
65-
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
66-
6762
try:
6863
asyncioreactor.install(asyncio.get_event_loop())
6964
except ReactorAlreadyInstalledError as e:

poetry.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ mnemonic = "~0.20"
6464
prometheus_client = "~0.15.0"
6565
pyopenssl = "=24.2.1"
6666
pycoin = "~0.92.20230326"
67-
pywin32 = {version = "306", markers = "sys_platform == 'win32'"}
6867
requests = "=2.32.3"
6968
service_identity = "~21.1.0"
7069
pexpect = "~4.8.0"
7170
intervaltree = "~3.1.0"
7271
structlog = "~22.3.0"
73-
rocksdb = {git = "https://github.com/hathornetwork/python-rocksdb.git", markers = "sys_platform != 'win32'"}
72+
rocksdb = {git = "https://github.com/hathornetwork/python-rocksdb.git"}
7473
aiohttp = "~3.10.3"
7574
idna = "~3.4"
7675
setproctitle = "^1.3.3"

tests/conftest.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import os
2-
import sys
32

43
from hathor.conf import UNITTESTS_SETTINGS_FILEPATH
54
from hathor.reactor import initialize_global_reactor
65

76
os.environ['HATHOR_CONFIG_YAML'] = os.environ.get('HATHOR_TEST_CONFIG_YAML', UNITTESTS_SETTINGS_FILEPATH)
87

9-
if sys.platform == 'win32':
10-
# XXX: because rocksdb isn't available on Windows, we force using memory-storage for tests so most of them can run
11-
os.environ['HATHOR_TEST_MEMORY_STORAGE'] = 'true'
12-
138
# TODO: We should remove this call from the module level.
149
initialize_global_reactor(use_asyncio_reactor=True)

tests/p2p/test_connections.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import sys
2-
3-
import pytest
4-
51
from hathor.p2p.entrypoint import Entrypoint
62
from tests import unittest
73
from tests.utils import run_server
84

95

106
class ConnectionsTest(unittest.TestCase):
11-
@pytest.mark.skipif(sys.platform == 'win32', reason='run_server is very finicky on Windows')
127
def test_connections(self) -> None:
138
process = run_server()
149
process2 = run_server(listen=8006, status=8086, bootstrap='tcp://127.0.0.1:8005')

tests/resources/test_profiler.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import os
22
import re
33
import shutil
4-
import sys
54
import tempfile
65

7-
import pytest
86
from twisted.internet.defer import inlineCallbacks
97

108
from hathor.profiler.resources import ProfilerResource
@@ -19,7 +17,6 @@ def setUp(self):
1917
super().setUp()
2018
self.web = StubSite(ProfilerResource(self.manager))
2119

22-
@pytest.mark.skipif(sys.platform == 'win32', reason='shutil.rmtree fails on Windows')
2320
@inlineCallbacks
2421
def test_post(self):
2522
# Options

tests/tx/test_prometheus.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import os
22
import shutil
3-
import sys
43
import tempfile
54

6-
import pytest
7-
85
from hathor.prometheus import PrometheusMetricsExporter
96
from hathor.simulator.utils import add_new_blocks
107
from tests import unittest
@@ -20,7 +17,6 @@ def setUp(self):
2017
self.network = 'testnet'
2118
self.manager = self.create_peer(self.network, unlock_wallet=True)
2219

23-
@pytest.mark.skipif(sys.platform == 'win32', reason='set_new_metrics fails on Windows')
2420
def test_wallet(self):
2521
tmpdir = tempfile.mkdtemp()
2622
tmpfile = tempfile.NamedTemporaryFile(dir=tmpdir, suffix='.prom', delete=False)

0 commit comments

Comments
 (0)