changeset 4679:d269f5f04f7a

win32: Remove dependency on external win32con module
author anatoly techtonik <techtonik@gmail.com>
date Tue, 27 Nov 2012 13:00:50 +0300
parents 23de24f57566
children b6b600ff61e2
files roundup/backends/portalocker.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/portalocker.py	Sun Nov 25 18:24:28 2012 -0500
+++ b/roundup/backends/portalocker.py	Tue Nov 27 13:00:50 2012 +0300
@@ -42,19 +42,18 @@
 import os
 
 if os.name == 'nt':
-    import win32con
     import win32file
     import pywintypes
-    LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
-    LOCK_SH = 0 # the default
-    LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
+    LOCK_SH = 0    # the default
+    LOCK_NB = 0x1  # LOCKFILE_FAIL_IMMEDIATELY
+    LOCK_EX = 0x2  # LOCKFILE_EXCLUSIVE_LOCK
     # is there any reason not to reuse the following structure?
     __overlapped = pywintypes.OVERLAPPED()
 elif os.name == 'posix':
     import fcntl
+    LOCK_SH = fcntl.LOCK_SH  # shared lock
+    LOCK_NB = fcntl.LOCK_NB  # non-blocking
     LOCK_EX = fcntl.LOCK_EX
-    LOCK_SH = fcntl.LOCK_SH
-    LOCK_NB = fcntl.LOCK_NB
 else:
     raise RuntimeError("PortaLocker only defined for nt and posix platforms")
 

Roundup Issue Tracker: http://roundup-tracker.org/