Package: portalocker
Version: 0.4~ds0-2
Severity: normal
Tags: patch

Dear maintainer,

The new upstream release provides portalocker with Python 3 support.

I've prepared an NMU for portalocker (versioned as 0.5~ds0-0.1) and
I intend to upload it to DELAYED/10. Please feel free to tell me if I
should delay it longer.

Regards.

-- 
Alessio Treglia          | www.alessiotreglia.com
Debian Developer         |     [email protected]
Ubuntu Core Developer    |  [email protected]
0416 0004 A827 6E40 BB98 90FB E8A4 8AE5 311D 765A
diff -Nru portalocker-0.4~ds0/CHANGELOG portalocker-0.5~ds0/CHANGELOG
--- portalocker-0.4~ds0/CHANGELOG	2013-11-16 01:22:37.000000000 +0000
+++ portalocker-0.5~ds0/CHANGELOG	2014-04-29 15:29:24.000000000 +0100
@@ -10,3 +10,15 @@
 
  * Now actually returning the file descriptor from the `Lock` class
 
+0.4:
+
+ * Fixing a few bugs, added coveralls support, switched to py.test and added 100% test coverage.
+
+    - Fixing exception thrown when fail_when_locked is true
+    - Fixing exception "Lock object has no attribute '_release_lock'" when
+      fail_when_locked is true due to the call to Lock._release_lock() which fails
+      because _release_lock is not defined.
+
+0.5:
+
+ * Python 3 support
diff -Nru portalocker-0.4~ds0/debian/changelog portalocker-0.5~ds0/debian/changelog
--- portalocker-0.4~ds0/debian/changelog	2014-01-05 22:37:03.000000000 +0000
+++ portalocker-0.5~ds0/debian/changelog	2014-04-30 11:41:45.000000000 +0100
@@ -1,3 +1,12 @@
+portalocker (0.5~ds0-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * New upstream release:
+    - Python3 support.
+  * Add Python3 package.
+
+ -- Alessio Treglia <[email protected]>  Wed, 30 Apr 2014 11:31:17 +0100
+
 portalocker (0.4~ds0-2) unstable; urgency=low
 
   * New Maintainer (Closes: #726634).
diff -Nru portalocker-0.4~ds0/debian/control portalocker-0.5~ds0/debian/control
--- portalocker-0.4~ds0/debian/control	2014-01-05 22:34:57.000000000 +0000
+++ portalocker-0.5~ds0/debian/control	2014-04-30 11:34:04.000000000 +0100
@@ -4,9 +4,15 @@
 Maintainer: Josue Ortega <[email protected]>
 Build-Depends:
  debhelper (>= 9~),
+ dh-python,
  python-all,
- python-setuptools
+ python-pytest,
+ python-setuptools,
+ python3-all,
+ python3-pytest,
+ python3-setuptools
 X-Python-Version: >= 2.6
+X-Python3-Version: >= 3.2
 Standards-Version: 3.9.5
 Homepage: https://github.com/WoLpH/portalocker
 
@@ -21,13 +27,13 @@
  .
  This is the Python 2 version of the package.
 
-#Package: python3-portalocker
-#Architecture: all
-#Depends:
-# ${misc:Depends},
-# ${python3:Depends}
-#Description: easy API to file locking (Python 3)
-# Portalocker is a cross-platform library to provide
-# an easy API to file locking.
-# .
-# This is the Python 3 version of the package.
+Package: python3-portalocker
+Architecture: all
+Depends:
+ ${misc:Depends},
+ ${python3:Depends}
+Description: easy API to file locking (Python 3)
+ Portalocker is a cross-platform library to provide
+ an easy API to file locking.
+ .
+ This is the Python 3 version of the package.
diff -Nru portalocker-0.4~ds0/debian/python-portalocker.install portalocker-0.5~ds0/debian/python-portalocker.install
--- portalocker-0.4~ds0/debian/python-portalocker.install	1970-01-01 01:00:00.000000000 +0100
+++ portalocker-0.5~ds0/debian/python-portalocker.install	2013-03-24 17:57:42.000000000 +0000
@@ -0,0 +1 @@
+usr/lib/python2*
diff -Nru portalocker-0.4~ds0/debian/python-portalocker.install.off portalocker-0.5~ds0/debian/python-portalocker.install.off
--- portalocker-0.4~ds0/debian/python-portalocker.install.off	2013-03-24 17:57:42.000000000 +0000
+++ portalocker-0.5~ds0/debian/python-portalocker.install.off	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-usr/lib/python2*
diff -Nru portalocker-0.4~ds0/debian/rules portalocker-0.5~ds0/debian/rules
--- portalocker-0.4~ds0/debian/rules	2014-04-12 10:25:04.000000000 +0100
+++ portalocker-0.5~ds0/debian/rules	2014-04-30 11:39:05.000000000 +0100
@@ -2,13 +2,32 @@
 
 export REPACK_SH=$(CURDIR)/debian/repack.sh
 
+PYTHON2=$(shell pyversions -vr)
+PYTHON3=$(shell py3versions -vr)
+
 %:
-	dh $@ --with python2
+	dh $@ --with python2,python3
+
+
+# Skipping tests as upstream doesn't provide them along with the tarball
+override_dh_auto_test:
 
 override_dh_auto_clean:
 	dh_auto_clean
 	rm -rf build
 	rm -rf *.egg-info
 
+build-python%:
+	python$* setup.py build
+
+override_dh_auto_build: $(PYTHON3:%=build-python%)
+	dh_auto_build
+
+install-python%:
+	python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
+
+override_dh_auto_install: $(PYTHON3:%=install-python%)
+	dh_auto_install
+
 get-orig-source:
 	uscan --force-download
diff -Nru portalocker-0.4~ds0/debian/rules.python3 portalocker-0.5~ds0/debian/rules.python3
--- portalocker-0.4~ds0/debian/rules.python3	2013-03-24 18:34:39.000000000 +0000
+++ portalocker-0.5~ds0/debian/rules.python3	1970-01-01 01:00:00.000000000 +0100
@@ -1,36 +0,0 @@
-#!/usr/bin/make -f
-
-export REPACK_SH=$(CURDIR)/debian/repack.sh
-
-PYTHON2=$(shell pyversions -vr)
-PYTHON3=$(shell py3versions -vr)
-
-%:
-	dh $@ --with python2,python3
-
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-test-python%:
-	python$* setup.py test -vv
-
-override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%)
-endif
-
-build-python%:
-	python$* setup.py build
-
-override_dh_auto_build: $(PYTHON3:%=build-python%)
-	dh_auto_build
-
-install-python%:
-	python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
-
-override_dh_auto_install: $(PYTHON3:%=install-python%)
-	dh_auto_install
-
-override_dh_auto_clean:
-	dh_auto_clean
-	rm -rf build
-	rm -rf *.egg-info
-
-get-orig-source:
-	uscan --force-download
diff -Nru portalocker-0.4~ds0/portalocker/__init__.py portalocker-0.5~ds0/portalocker/__init__.py
--- portalocker-0.4~ds0/portalocker/__init__.py	2013-11-16 02:12:06.000000000 +0000
+++ portalocker-0.5~ds0/portalocker/__init__.py	2014-04-29 15:25:13.000000000 +0100
@@ -1,5 +1,5 @@
-from portalocker import lock, unlock, LOCK_EX, LOCK_SH, LOCK_NB, LockException
-from utils import Lock, AlreadyLocked
+from .portalocker import lock, unlock, LOCK_EX, LOCK_SH, LOCK_NB, LockException
+from .utils import Lock, AlreadyLocked
 
 __all__ = [
     'lock',
diff -Nru portalocker-0.4~ds0/portalocker/portalocker.py portalocker-0.5~ds0/portalocker/portalocker.py
--- portalocker-0.4~ds0/portalocker/portalocker.py	2013-11-16 03:41:21.000000000 +0000
+++ portalocker-0.5~ds0/portalocker/portalocker.py	2014-04-29 15:25:13.000000000 +0100
@@ -84,11 +84,11 @@
     raise RuntimeError('PortaLocker only defined for nt and posix platforms')
 
 
-def nt_lock(file, flags):  # pragma: no cover
-    hfile = win32file._get_osfhandle(file.fileno())
+def nt_lock(file_, flags):  # pragma: no cover
+    hfile = win32file._get_osfhandle(file_.fileno())
     try:
         win32file.LockFileEx(hfile, flags, 0, -0x10000, __overlapped)
-    except pywintypes.error, exc_value:
+    except pywintypes.error as exc_value:
         # error: (33, 'LockFileEx', 'The process cannot access the file
         # because another process has locked a portion of the file.')
         if exc_value[0] == 33:
@@ -99,11 +99,11 @@
             raise
 
 
-def nt_unlock(file):  # pragma: no cover
-    hfile = win32file._get_osfhandle(file.fileno())
+def nt_unlock(file_):  # pragma: no cover
+    hfile = win32file._get_osfhandle(file_.fileno())
     try:
         win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped)
-    except pywintypes.error, exc_value:
+    except pywintypes.error as exc_value:
         if exc_value[0] == 158:
             # error: (158, 'UnlockFileEx', 'The segment is already '
             #         'unlocked.')
@@ -116,17 +116,17 @@
             raise
 
 
-def posix_lock(file, flags):
+def posix_lock(file_, flags):
     try:
-        fcntl.flock(file.fileno(), flags)
-    except IOError, exc_value:
+        fcntl.flock(file_.fileno(), flags)
+    except IOError as exc_value:
         # The exception code varies on different systems so we'll catch
         # every IO error
-        raise LockException(*exc_value)
+        raise LockException(exc_value)
 
 
-def posix_unlock(file):
-    fcntl.flock(file.fileno(), fcntl.LOCK_UN)
+def posix_unlock(file_):
+    fcntl.flock(file_.fileno(), fcntl.LOCK_UN)
 
 if os.name == 'nt':  # pragma: no cover
     lock = nt_lock
@@ -136,19 +136,3 @@
     unlock = posix_unlock
 else:  # pragma: no cover
     raise RuntimeError('Your os %r is unsupported.' % os.name)
-
-if __name__ == '__main__':  # pragma: no cover
-    from time import time, strftime, localtime
-    import sys
-    import portalocker
-
-    log = open('log.txt', 'a+')
-    portalocker.lock(log, portalocker.LOCK_EX)
-
-    timestamp = strftime('%m/%d/%Y %H:%M:%S\n', localtime(time()))
-    log.write(timestamp)
-
-    print 'Wrote lines. Hit enter to release lock.'
-    dummy = sys.stdin.readline()
-
-    log.close()
diff -Nru portalocker-0.4~ds0/portalocker/utils.py portalocker-0.5~ds0/portalocker/utils.py
--- portalocker-0.4~ds0/portalocker/utils.py	2013-11-16 03:51:14.000000000 +0000
+++ portalocker-0.5~ds0/portalocker/utils.py	2014-04-29 15:25:13.000000000 +0100
@@ -1,4 +1,4 @@
-from __future__ import with_statement
+
 import time
 from . import portalocker
 
@@ -55,6 +55,8 @@
         '''Acquire the locked filehandle'''
         if timeout is None:
             timeout = self.timeout
+        if timeout is None:
+            timeout = 0
 
         if check_interval is None:
             check_interval = self.check_interval
@@ -72,7 +74,7 @@
         try:
             # Try to lock
             fh = self._get_lock(fh)
-        except portalocker.LockException, exception:
+        except portalocker.LockException as exception:
             # Try till the timeout is 0
             while timeout > 0:
                 # Wait a bit
@@ -85,7 +87,7 @@
                     # We already tried to the get the lock
                     # If fail_when_locked is true, then stop trying
                     if fail_when_locked:
-                        raise AlreadyLocked(*exception)
+                        raise AlreadyLocked(exception)
 
                     else:  # pragma: no cover
                         # We've got the lock
@@ -97,7 +99,7 @@
 
             else:
                 # We got a timeout... reraising
-                raise portalocker.LockException(*exception)
+                raise portalocker.LockException(exception)
 
         # Prepare the filehandle (truncate if needed)
         fh = self._prepare_fh(fh)
@@ -137,6 +139,6 @@
         self.fh = self.acquire()
         return self.fh
 
-    def __exit__(self, type, value, tb):
+    def __exit__(self, type_, value, tb):
         if self.fh:
             self.fh.close()
diff -Nru portalocker-0.4~ds0/README.rest portalocker-0.5~ds0/README.rest
--- portalocker-0.4~ds0/README.rest	2013-11-16 01:22:37.000000000 +0000
+++ portalocker-0.5~ds0/README.rest	2014-04-29 15:18:41.000000000 +0100
@@ -2,6 +2,22 @@
 portalocker - Cross-platform locking library
 ############################################
 
+.. image:: https://travis-ci.org/WoLpH/portalocker.png?branch=master
+    :alt: Test Status
+    :target: https://travis-ci.org/WoLpH/portalocker
+
+.. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.png?branch=master
+    :alt: Coverage Status
+    :target: https://coveralls.io/r/WoLpH/portalocker?branch=master
+
+.. image:: https://landscape.io/github/WoLpH/portalocker/master/landscape.png
+   :target: https://landscape.io/github/WoLpH/portalocker/master
+   :alt: Code Health
+
+.. image:: https://requires.io/github/WoLpH/portalocker/requirements.png?branch=master
+   :target: https://requires.io/github/WoLpH/portalocker/requirements/?branch=master
+   :alt: Requirements Status
+
 Overview
 --------
 
diff -Nru portalocker-0.4~ds0/setup.py portalocker-0.5~ds0/setup.py
--- portalocker-0.4~ds0/setup.py	2013-11-16 04:43:47.000000000 +0000
+++ portalocker-0.5~ds0/setup.py	2014-04-29 15:25:46.000000000 +0100
@@ -4,7 +4,7 @@
 
 author = 'Rick van Hattem'
 email = '[email protected]'
-version = '0.4'
+version = '0.5'
 desc = '''Wraps the portalocker recipe for easy usage'''
 
 extra = {}

Attachment: signature.asc
Description: Digital signature

Reply via email to