Revert "dev-python/lockfile: Drop old"

This reverts commit b001341676e39eca2364fea454ab5221e7fe2c8d.
This commit is contained in:
Justin Lecher
2015-11-02 12:02:23 +01:00
parent 88371fdd7e
commit cefc60a8a7
5 changed files with 196 additions and 1 deletions

View File

@@ -1 +1,3 @@
DIST lockfile-0.10.2.tar.gz 20662 SHA256 9e42252f17d1dd89ee31745e0c4fbe58862c25147eb0ef5295c9cd9bcb4ea2c1 SHA512 7d70bcf7c343228f144687dd2cbc47a525034a68134fa626077d08308e6abce80559e36e9f65859d4c46873c712f62e1d6bb2aeec422d337332b65caf2e430a8 WHIRLPOOL d23a0b99da2304d9c884e69df7fbae4e507d7bab35fe450f2062aba44b4c85fd2c1585012cd02a56c886b50c44fb5a470afe13546f828297c498c3a8551eda86
DIST lockfile-0.11.0.tar.gz 20909 SHA256 eed7e0c829135aaaf2a9df83652bc6e2cc50175d933741c25aac0394674e7fd3 SHA512 6c4c69e1434194076a99f8134a2558c791675d420a17687dfd5b38c1303564392ecc388ec285d55a20027bcbcbc1b3475a489b70390796c46346b89d4b18ad89 WHIRLPOOL 3fe41cec5f22109ce17e249a02469201e74cc6facd18bbcd5d6b75984f1f72e66d36eab68772d9bc6aa0c1ef6597f3bdf8f8757d9f867323d152cca8a47a445f
DIST lockfile-0.9.1.tar.gz 16949 SHA256 88d8ea8d435ee5691117a87d1ca8fed2f8da881eb145295bf6895ac2c416e95d SHA512 1f7e2b13c42df730339e653a361bf4b85a289d62ed9277f159ab454b1e951d922884086299912472236ce0772d5eceebab7e0c6407590bb2ccbe9c56b664de05 WHIRLPOOL 543bc9ad7e937feba52c6132eee3356a9a229c8866f4f605f8399343a676fc98f62bf33f121c4f8dcbac8e18f38168561d34119efea5e30b53427a7e7283055d

View File

@@ -0,0 +1,107 @@
# https://github.com/smontanaro/pylockfile/commit/379fa0b6131995f96f5bd048906fc0bd3c2527f7
# https://github.com/smontanaro/pylockfile/commit/eeead7d35e9a97b457b90edd241fd031df68d57b
# https://github.com/smontanaro/pylockfile/commit/bf2627a5b9f83e1bbcf1b5030a693acb6236a211
--- a/lockfile/__init__.py
+++ b/lockfile/__init__.py
@@ -1,4 +1,3 @@
-
"""
lockfile.py - Platform-independent advisory file locks.
@@ -50,6 +49,8 @@ Exceptions:
NotMyLock - File was locked but not by the current thread/process
"""
+from __future__ import absolute_import
+
import sys
import socket
import os
@@ -257,7 +258,7 @@ def LinkFileLock(*args, **kwds):
Do not use in new code. Instead, import LinkLockFile from the
lockfile.linklockfile module.
"""
- import linklockfile
+ from . import linklockfile
return _fl_helper(linklockfile.LinkLockFile, "lockfile.linklockfile",
*args, **kwds)
@@ -267,7 +268,7 @@ def MkdirFileLock(*args, **kwds):
Do not use in new code. Instead, import MkdirLockFile from the
lockfile.mkdirlockfile module.
"""
- import mkdirlockfile
+ from . import mkdirlockfile
return _fl_helper(mkdirlockfile.MkdirLockFile, "lockfile.mkdirlockfile",
*args, **kwds)
@@ -277,7 +278,7 @@ def SQLiteFileLock(*args, **kwds):
Do not use in new code. Instead, import SQLiteLockFile from the
lockfile.mkdirlockfile module.
"""
- import sqlitelockfile
+ from . import sqlitelockfile
return _fl_helper(sqlitelockfile.SQLiteLockFile, "lockfile.sqlitelockfile",
*args, **kwds)
@@ -306,10 +307,10 @@ def locked(path, timeout=None):
return decor
if hasattr(os, "link"):
- import linklockfile as _llf
+ from . import linklockfile as _llf
LockFile = _llf.LinkLockFile
else:
- import mkdirlockfile as _mlf
+ from . import mkdirlockfile as _mlf
LockFile = _mlf.MkdirLockFile
FileLock = LockFile
diff --git a/lockfile/pidlockfile.py b/lockfile/pidlockfile.py
index 3fc8f63..a965ba8 100644
--- a/lockfile/pidlockfile.py
+++ b/lockfile/pidlockfile.py
@@ -78,7 +78,7 @@ class PIDLockFile(LockBase):
while True:
try:
write_pid_to_pidfile(self.path)
- except OSError, exc:
+ except OSError as exc:
if exc.errno == errno.EEXIST:
# The lock creation failed. Maybe sleep a bit.
if timeout is not None and time.time() > end_time:
@@ -159,7 +159,7 @@ def write_pid_to_pidfile(pidfile_path):
"""
open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY)
- open_mode = 0644
+ open_mode = 0o644
pidfile_fd = os.open(pidfile_path, open_flags, open_mode)
pidfile = os.fdopen(pidfile_fd, 'w')
@@ -186,7 +186,7 @@ def remove_existing_pidfile(pidfile_path):
"""
try:
os.remove(pidfile_path)
- except OSError, exc:
+ except OSError as exc:
if exc.errno == errno.ENOENT:
pass
else:
diff --git a/lockfile/sqlitelockfile.py b/lockfile/sqlitelockfile.py
index ec75490..d596229 100644
--- a/lockfile/sqlitelockfile.py
+++ b/lockfile/sqlitelockfile.py
@@ -3,6 +3,11 @@ from __future__ import absolute_import, division
import time
import os
+try:
+ unicode
+except NameError:
+ unicode = str
+
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):

View File

@@ -0,0 +1,43 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy pypy3 )
inherit distutils-r1
DESCRIPTION="Platform-independent file locking module"
HOMEPAGE="https://launchpad.net/pylockfile https://pypi.python.org/pypi/lockfile"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="doc test"
DEPEND="
dev-python/pbr[${PYTHON_USEDEP}]
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? ( dev-python/nose[${PYTHON_USEDEP}] )"
RDEPEND=""
DOCS=( ACKS README RELEASE-NOTES )
python_compile_all() {
if use doc; then
einfo "Generation of documentation"
emake -C doc/source html || die "Generation of documentation failed"
fi
}
python_test() {
# "${PYTHON}" test/test_lockfile.py yeilds no informative coverage output
nosetests || die "test_lockfile failed under ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( doc/source/.build/html/. )
distutils-r1_python_install_all
}

View File

@@ -14,7 +14,7 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="doc test"
DEPEND="

View File

@@ -0,0 +1,43 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
# py2.5 dropped; Test file reveals py2.5 can't support a core file
PYTHON_COMPAT=( python{2_7,3_3,3_4} pypy )
inherit distutils-r1
DESCRIPTION="Platform-independent file locking module"
HOMEPAGE="https://code.google.com/p/pylockfile/ https://pypi.python.org/pypi/lockfile http://smontanaro.dyndns.org/python/"
SRC_URI="https://pylockfile.googlecode.com/files/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 arm ppc ~sparc x86"
IUSE="doc test"
DEPEND="doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? ( dev-python/nose[${PYTHON_USEDEP}] )"
RDEPEND=""
DOCS=( ACKS README RELEASE-NOTES )
PATCHES=( "${FILESDIR}"/py3-support.patch )
python_compile_all() {
if use doc; then
einfo "Generation of documentation"
emake -C doc html || die "Generation of documentation failed"
fi
}
python_test() {
# "${PYTHON}" test/test_lockfile.py yeilds no informative coverage output
nosetests || die "test_lockfile failed under ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( doc/.build/html/. )
distutils-r1_python_install_all
}