Skip to content

Commit 7f3cd13

Browse files
committed
win32: Remove dependency on external win32con module
1 parent f2d0ded commit 7f3cd13

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

roundup/backends/portalocker.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,18 @@
4242
import os
4343

4444
if os.name == 'nt':
45-
import win32con
4645
import win32file
4746
import pywintypes
48-
LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
49-
LOCK_SH = 0 # the default
50-
LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
47+
LOCK_SH = 0 # the default
48+
LOCK_NB = 0x1 # LOCKFILE_FAIL_IMMEDIATELY
49+
LOCK_EX = 0x2 # LOCKFILE_EXCLUSIVE_LOCK
5150
# is there any reason not to reuse the following structure?
5251
__overlapped = pywintypes.OVERLAPPED()
5352
elif os.name == 'posix':
5453
import fcntl
54+
LOCK_SH = fcntl.LOCK_SH # shared lock
55+
LOCK_NB = fcntl.LOCK_NB # non-blocking
5556
LOCK_EX = fcntl.LOCK_EX
56-
LOCK_SH = fcntl.LOCK_SH
57-
LOCK_NB = fcntl.LOCK_NB
5857
else:
5958
raise RuntimeError("PortaLocker only defined for nt and posix platforms")
6059

0 commit comments

Comments
 (0)