Skip to content

Commit 73ddf02

Browse files
committed
drop msvcrt: we don't support MS Windows anyhow
1 parent 9c768e9 commit 73ddf02

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

cwltool/utils.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Shared functions and other definitions."""
22
import collections
3+
import fcntl
34
import importlib.metadata
45
import os
56
import random
@@ -17,7 +18,6 @@
1718
from itertools import zip_longest
1819
from pathlib import Path, PurePosixPath
1920
from tempfile import NamedTemporaryFile
20-
from types import ModuleType
2121
from typing import (
2222
IO,
2323
TYPE_CHECKING,
@@ -241,29 +241,12 @@ def random_outdir() -> str:
241241
return __random_outdir
242242

243243

244-
#
245-
# Simple multi-platform (fcntl/msvrt) file locking wrapper
246-
#
247-
fcntl: Optional[ModuleType] = None
248-
msvcrt: Optional[ModuleType] = None
249-
try:
250-
import fcntl
251-
except ImportError:
252-
import msvcrt
253-
254-
255244
def shared_file_lock(fd: IO[Any]) -> None:
256-
if fcntl:
257-
fcntl.flock(fd.fileno(), fcntl.LOCK_SH)
258-
elif msvcrt:
259-
msvcrt.locking(fd.fileno(), msvcrt.LK_LOCK, 1024)
245+
fcntl.flock(fd.fileno(), fcntl.LOCK_SH)
260246

261247

262248
def upgrade_lock(fd: IO[Any]) -> None:
263-
if fcntl:
264-
fcntl.flock(fd.fileno(), fcntl.LOCK_EX)
265-
elif msvcrt:
266-
pass
249+
fcntl.flock(fd.fileno(), fcntl.LOCK_EX)
267250

268251

269252
def adjustFileObjs(rec: Any, op: Union[Callable[..., Any], "partial[Any]"]) -> None:

0 commit comments

Comments
 (0)