[Python-modules-commits] [portalocker] 01/04: Import portalocker_0.5.5.orig.tar.gz

Josué Ortega noahfx-guest at moszumanska.debian.org
Sat Feb 6 22:46:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

noahfx-guest pushed a commit to branch master
in repository portalocker.

commit de6ab2fe9f11040e637fc5ea173d0212bf73a5c6
Author: Josue Ortega <josueortega at debian.org.gt>
Date:   Sat Feb 6 16:36:08 2016 -0600

    Import portalocker_0.5.5.orig.tar.gz
---
 PKG-INFO                         | 14 ++++++--------
 README.rest => README.rst        | 12 +++++-------
 portalocker.egg-info/PKG-INFO    | 14 ++++++--------
 portalocker.egg-info/SOURCES.txt |  3 ++-
 portalocker.egg-info/pbr.json    |  1 +
 portalocker/portalocker.py       |  7 ++++---
 portalocker/utils.py             |  6 ++++--
 setup.cfg                        |  2 +-
 setup.py                         |  4 ++--
 9 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index c31ae44..e23a4ad 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: portalocker
-Version: 0.5.4
+Version: 0.5.5
 Summary: Wraps the portalocker recipe for easy usage
 Home-page: https://github.com/WoLpH/portalocker
 Author: Rick van Hattem
@@ -10,11 +10,11 @@ Description: ############################################
         portalocker - Cross-platform locking library
         ############################################
         
-        .. image:: https://travis-ci.org/WoLpH/portalocker.png?branch=master
+        .. image:: https://travis-ci.org/WoLpH/portalocker.svg?branch=master
             :alt: Test Status
             :target: https://travis-ci.org/WoLpH/portalocker
         
-        .. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.png?branch=master
+        .. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.svg?branch=master
             :alt: Coverage Status
             :target: https://coveralls.io/r/WoLpH/portalocker?branch=master
         
@@ -22,10 +22,6 @@ Description: ############################################
            :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
         --------
         
@@ -49,6 +45,8 @@ Description: ############################################
             - https://github.com/WoLpH/portalocker/issues
         * Package homepage
             - https://pypi.python.org/pypi/portalocker
+        * My blog
+            - http://w.wol.ph/
         
         Examples
         --------
@@ -59,7 +57,7 @@ Description: ############################################
         >>> with portalocker.Lock('somefile', timeout=1) as fh:
             print >>fh, 'writing some stuff to my cache...'
         
-        To lock a file exclusively, use the `lock` method:
+        To customize the opening and locking a manual approach is also possible:
         
         >>> import portalocker
         >>> file = open('somefile', 'r+')
diff --git a/README.rest b/README.rst
similarity index 84%
rename from README.rest
rename to README.rst
index 8bb1c9f..5212491 100644
--- a/README.rest
+++ b/README.rst
@@ -2,11 +2,11 @@
 portalocker - Cross-platform locking library
 ############################################
 
-.. image:: https://travis-ci.org/WoLpH/portalocker.png?branch=master
+.. image:: https://travis-ci.org/WoLpH/portalocker.svg?branch=master
     :alt: Test Status
     :target: https://travis-ci.org/WoLpH/portalocker
 
-.. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.png?branch=master
+.. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.svg?branch=master
     :alt: Coverage Status
     :target: https://coveralls.io/r/WoLpH/portalocker?branch=master
 
@@ -14,10 +14,6 @@ portalocker - Cross-platform locking library
    :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
 --------
 
@@ -41,6 +37,8 @@ Links
     - https://github.com/WoLpH/portalocker/issues
 * Package homepage
     - https://pypi.python.org/pypi/portalocker
+* My blog
+    - http://w.wol.ph/
 
 Examples
 --------
@@ -51,7 +49,7 @@ To make sure your cache generation scripts don't race, use the `Lock` class:
 >>> with portalocker.Lock('somefile', timeout=1) as fh:
     print >>fh, 'writing some stuff to my cache...'
 
-To lock a file exclusively, use the `lock` method:
+To customize the opening and locking a manual approach is also possible:
 
 >>> import portalocker
 >>> file = open('somefile', 'r+')
diff --git a/portalocker.egg-info/PKG-INFO b/portalocker.egg-info/PKG-INFO
index c31ae44..e23a4ad 100644
--- a/portalocker.egg-info/PKG-INFO
+++ b/portalocker.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: portalocker
-Version: 0.5.4
+Version: 0.5.5
 Summary: Wraps the portalocker recipe for easy usage
 Home-page: https://github.com/WoLpH/portalocker
 Author: Rick van Hattem
@@ -10,11 +10,11 @@ Description: ############################################
         portalocker - Cross-platform locking library
         ############################################
         
-        .. image:: https://travis-ci.org/WoLpH/portalocker.png?branch=master
+        .. image:: https://travis-ci.org/WoLpH/portalocker.svg?branch=master
             :alt: Test Status
             :target: https://travis-ci.org/WoLpH/portalocker
         
-        .. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.png?branch=master
+        .. image:: https://coveralls.io/repos/WoLpH/portalocker/badge.svg?branch=master
             :alt: Coverage Status
             :target: https://coveralls.io/r/WoLpH/portalocker?branch=master
         
@@ -22,10 +22,6 @@ Description: ############################################
            :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
         --------
         
@@ -49,6 +45,8 @@ Description: ############################################
             - https://github.com/WoLpH/portalocker/issues
         * Package homepage
             - https://pypi.python.org/pypi/portalocker
+        * My blog
+            - http://w.wol.ph/
         
         Examples
         --------
@@ -59,7 +57,7 @@ Description: ############################################
         >>> with portalocker.Lock('somefile', timeout=1) as fh:
             print >>fh, 'writing some stuff to my cache...'
         
-        To lock a file exclusively, use the `lock` method:
+        To customize the opening and locking a manual approach is also possible:
         
         >>> import portalocker
         >>> file = open('somefile', 'r+')
diff --git a/portalocker.egg-info/SOURCES.txt b/portalocker.egg-info/SOURCES.txt
index cf6b897..f2195af 100644
--- a/portalocker.egg-info/SOURCES.txt
+++ b/portalocker.egg-info/SOURCES.txt
@@ -1,7 +1,7 @@
 CHANGELOG
 LICENSE
 MANIFEST.in
-README.rest
+README.rst
 setup.cfg
 setup.py
 portalocker/__init__.py
@@ -11,4 +11,5 @@ portalocker.egg-info/PKG-INFO
 portalocker.egg-info/SOURCES.txt
 portalocker.egg-info/dependency_links.txt
 portalocker.egg-info/not-zip-safe
+portalocker.egg-info/pbr.json
 portalocker.egg-info/top_level.txt
\ No newline at end of file
diff --git a/portalocker.egg-info/pbr.json b/portalocker.egg-info/pbr.json
new file mode 100644
index 0000000..750d589
--- /dev/null
+++ b/portalocker.egg-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "12a1dc5"}
\ No newline at end of file
diff --git a/portalocker/portalocker.py b/portalocker/portalocker.py
index f01ecda..ddf1662 100644
--- a/portalocker/portalocker.py
+++ b/portalocker/portalocker.py
@@ -70,6 +70,7 @@ if os.name == 'nt':  # pragma: no cover
     import win32con
     import win32file
     import pywintypes
+    import winerror
     LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
     LOCK_SH = 0  # the default
     LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
@@ -91,8 +92,8 @@ def nt_lock(file_, flags):  # pragma: no cover
     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:
-            raise LockException(LockException.LOCK_FAILED, exc_value[2])
+        if exc_value.winerror == winerror.ERROR_LOCK_VIOLATION:
+            raise LockException(LockException.LOCK_FAILED, exc_value.strerror)
         else:
             # Q:  Are there exceptions/codes we should be dealing with
             # here?
@@ -104,7 +105,7 @@ def nt_unlock(file_):  # pragma: no cover
     try:
         win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped)
     except pywintypes.error as exc_value:
-        if exc_value[0] == 158:
+        if exc_value.winerror == winerror.ERROR_NOT_LOCKED:
             # error: (158, 'UnlockFileEx', 'The segment is already '
             #         'unlocked.')
             # To match the 'posix' implementation, silently ignore this
diff --git a/portalocker/utils.py b/portalocker/utils.py
index 9f10f95..e5766ea 100644
--- a/portalocker/utils.py
+++ b/portalocker/utils.py
@@ -20,7 +20,8 @@ class Lock(object):
 
     def __init__(
             self, filename, mode='a', truncate=0, timeout=DEFAULT_TIMEOUT,
-            check_interval=DEFAULT_CHECK_INTERVAL, fail_when_locked=True):
+            check_interval=DEFAULT_CHECK_INTERVAL, fail_when_locked=True,
+            flags=LOCK_METHOD):
         '''Lock manager with build-in timeout
 
         filename -- filename
@@ -47,6 +48,7 @@ class Lock(object):
         self.timeout = timeout
         self.check_interval = check_interval
         self.fail_when_locked = fail_when_locked
+        self.flags = flags
 
         assert 'w' not in mode, 'Mode "w" clears the file before locking'
 
@@ -116,7 +118,7 @@ class Lock(object):
         Try to lock the given filehandle
 
         returns LockException if it fails'''
-        portalocker.lock(fh, LOCK_METHOD)
+        portalocker.lock(fh, self.flags)
         return fh
 
     def _prepare_fh(self, fh, truncate=None):
diff --git a/setup.cfg b/setup.cfg
index e20a6dd..934a773 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [metadata]
-description-file = README.rest
+description-file = README.rst
 
 [build_sphinx]
 source-dir = docs/
diff --git a/setup.py b/setup.py
index 6aa5398..2ec104a 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ from setuptools.command.test import test as TestCommand
 __package_name__ = 'portalocker'
 __author__ = 'Rick van Hattem'
 __email__ = 'wolph at wol.ph'
-__version__ = '0.5.4'
+__version__ = '0.5.5'
 __description__ = '''Wraps the portalocker recipe for easy usage'''
 __url__ = 'https://github.com/WoLpH/portalocker'
 
@@ -32,7 +32,7 @@ if __name__ == '__main__':
         name=__package_name__,
         version=__version__,
         description=__description__,
-        long_description=open('README.rest').read(),
+        long_description=open('README.rst').read(),
         classifiers=[
             'Intended Audience :: Developers',
             'Programming Language :: Python',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/portalocker.git



More information about the Python-modules-commits mailing list