diff options
| author | Kevin Brown <kevin@kevinbrown.in> | 2014-07-13 15:41:15 -0400 |
|---|---|---|
| committer | Kevin Brown <kevin@kevinbrown.in> | 2014-07-13 15:41:15 -0400 |
| commit | b6c493deb2341fb843d71b66b2aa23078638755c (patch) | |
| tree | db4695c1056b41136180c9cef8fdf4342e499862 /gitdb | |
| parent | 1c6f4c19289732bd13507eba9e54c9d692957137 (diff) | |
| download | gitdb-b6c493deb2341fb843d71b66b2aa23078638755c.tar.gz | |
Pick off the low hanging fruit
This fixes most of the import errors that came from using the
implicit relative imports that Python 2 supports. This also fixes
the use of `xrange`, which has replaced `range` in Python 3. The
same has happened for `izip`, which is also being aliased.
The octal number syntax changed in Python 3, so we are now
converting from strings using the `int` built-in function, which
will produce the same output across both versions of Python.
Diffstat (limited to 'gitdb')
| -rw-r--r-- | gitdb/__init__.py | 7 | ||||
| -rw-r--r-- | gitdb/base.py | 18 | ||||
| -rw-r--r-- | gitdb/db/__init__.py | 13 | ||||
| -rw-r--r-- | gitdb/db/base.py | 1 | ||||
| -rw-r--r-- | gitdb/db/git.py | 18 | ||||
| -rw-r--r-- | gitdb/db/loose.py | 20 | ||||
| -rw-r--r-- | gitdb/db/mem.py | 23 | ||||
| -rw-r--r-- | gitdb/db/pack.py | 14 | ||||
| -rw-r--r-- | gitdb/db/ref.py | 10 | ||||
| -rw-r--r-- | gitdb/exc.py | 2 | ||||
| -rw-r--r-- | gitdb/fun.py | 21 | ||||
| -rw-r--r-- | gitdb/pack.py | 94 | ||||
| -rw-r--r-- | gitdb/stream.py | 43 | ||||
| -rw-r--r-- | gitdb/test/__init__.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/lib.py | 12 | ||||
| -rw-r--r-- | gitdb/test/db/test_git.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_loose.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_mem.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_pack.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_ref.py | 2 | ||||
| -rw-r--r-- | gitdb/test/lib.py | 11 | ||||
| -rw-r--r-- | gitdb/test/test_base.py | 2 | ||||
| -rw-r--r-- | gitdb/test/test_example.py | 12 | ||||
| -rw-r--r-- | gitdb/test/test_pack.py | 23 | ||||
| -rw-r--r-- | gitdb/test/test_stream.py | 16 | ||||
| -rw-r--r-- | gitdb/test/test_util.py | 2 | ||||
| -rw-r--r-- | gitdb/util.py | 18 |
27 files changed, 228 insertions, 164 deletions
diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 847269a..66d1b1c 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -32,7 +32,6 @@ __version__ = '.'.join(str(i) for i in version_info) # default imports -from db import * -from base import * -from stream import * - +from gitdb.base import * +from gitdb.db import * +from gitdb.stream import * diff --git a/gitdb/base.py b/gitdb/base.py index a673c23..1eb4232 100644 --- a/gitdb/base.py +++ b/gitdb/base.py @@ -3,15 +3,15 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Module with basic data structures - they are designed to be lightweight and fast""" -from util import ( - bin_to_hex, - zlib - ) - -from fun import ( - type_id_to_type_map, - type_to_type_id_map - ) +from gitdb.util import ( + bin_to_hex, + zlib +) + +from gitdb.fun import ( + type_id_to_type_map, + type_to_type_id_map +) __all__ = ('OInfo', 'OPackInfo', 'ODeltaPackInfo', 'OStream', 'OPackStream', 'ODeltaPackStream', diff --git a/gitdb/db/__init__.py b/gitdb/db/__init__.py index e5935b7..0a2a46a 100644 --- a/gitdb/db/__init__.py +++ b/gitdb/db/__init__.py @@ -3,10 +3,9 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from base import * -from loose import * -from mem import * -from pack import * -from git import * -from ref import * - +from gitdb.db.base import * +from gitdb.db.loose import * +from gitdb.db.mem import * +from gitdb.db.pack import * +from gitdb.db.git import * +from gitdb.db.ref import * diff --git a/gitdb/db/base.py b/gitdb/db/base.py index 0eef1e5..85df324 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -20,6 +20,7 @@ from async import ( ) from itertools import chain +from functools import reduce __all__ = ('ObjectDBR', 'ObjectDBW', 'FileDBBase', 'CompoundDB', 'CachingDB') diff --git a/gitdb/db/git.py b/gitdb/db/git.py index 6e6ec5d..5c74a20 100644 --- a/gitdb/db/git.py +++ b/gitdb/db/git.py @@ -2,15 +2,15 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from base import ( - CompoundDB, - ObjectDBW, - FileDBBase - ) - -from loose import LooseObjectDB -from pack import PackedDB -from ref import ReferenceDB +from gitdb.db.base import ( + CompoundDB, + ObjectDBW, + FileDBBase +) + +from gitdb.db.loose import LooseObjectDB +from gitdb.db.pack import PackedDB +from gitdb.db.ref import ReferenceDB from gitdb.util import LazyMixin from gitdb.exc import ( diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 4ebca84..ac1b9d1 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -2,11 +2,11 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from base import ( - FileDBBase, - ObjectDBR, - ObjectDBW - ) +from gitdb.db.base import ( + FileDBBase, + ObjectDBR, + ObjectDBW +) from gitdb.exc import ( @@ -69,11 +69,11 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): # On windows we need to keep it writable, otherwise it cannot be removed # either - new_objects_mode = 0444 + new_objects_mode = int("444", 8) if os.name == 'nt': - new_objects_mode = 0644 - - + new_objects_mode = int("644", 8) + + def __init__(self, root_path): super(LooseObjectDB, self).__init__(root_path) self._hexsha_to_file = dict() @@ -133,7 +133,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): db_path = self.db_path(self.object_path(bin_to_hex(sha))) try: return file_contents_ro_filepath(db_path, flags=self._fd_open_flags) - except OSError,e: + except OSError as e: if e.errno != ENOENT: # try again without noatime try: diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index e4fba94..3847c34 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -3,11 +3,11 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Contains the MemoryDatabase implementation""" -from loose import LooseObjectDB -from base import ( - ObjectDBR, - ObjectDBW - ) +from gitdb.db.loose import LooseObjectDB +from gitdb.db.base import ( + ObjectDBR, + ObjectDBW +) from gitdb.base import ( OStream, @@ -19,7 +19,18 @@ from gitdb.exc import ( UnsupportedOperation ) -from cStringIO import StringIO +from gitdb.stream import ( + ZippedStoreShaWriter, + DecompressMemMapReader, +) + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO __all__ = ("MemoryDB", ) diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 09f8118..eca02bb 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -3,11 +3,11 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Module containing a database to deal with packs""" -from base import ( - FileDBBase, - ObjectDBR, - CachingDB - ) +from gitdb.db.base import ( + FileDBBase, + ObjectDBR, + CachingDB +) from gitdb.util import LazyMixin @@ -19,6 +19,8 @@ from gitdb.exc import ( from gitdb.pack import PackEntity +from functools import reduce + import os import glob @@ -104,7 +106,7 @@ class PackedDB(FileDBBase, ObjectDBR, CachingDB, LazyMixin): for entity in self.entities(): index = entity.index() sha_by_index = index.sha - for index in xrange(index.size()): + for index in range(index.size()): yield sha_by_index(index) # END for each index # END for each entity diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py index 368ab9a..748f7c1 100644 --- a/gitdb/db/ref.py +++ b/gitdb/db/ref.py @@ -2,9 +2,9 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from base import ( - CompoundDB, - ) +from gitdb.db.base import ( + CompoundDB, +) import os __all__ = ('ReferenceDB', ) @@ -33,7 +33,7 @@ class ReferenceDB(CompoundDB): dbcls = self.ObjectDBCls if dbcls is None: # late import - from git import GitDB + from gitdb.db.git import GitDB dbcls = GitDB # END get db type @@ -68,7 +68,7 @@ class ReferenceDB(CompoundDB): db.databases() # END verification self._dbs.append(db) - except Exception, e: + except Exception: # ignore invalid paths or issues pass # END for each path to add diff --git a/gitdb/exc.py b/gitdb/exc.py index 47fc809..73f84d2 100644 --- a/gitdb/exc.py +++ b/gitdb/exc.py @@ -3,7 +3,7 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Module with common exceptions""" -from util import to_hex_sha +from gitdb.util import to_hex_sha class ODBError(Exception): """All errors thrown by the object database""" diff --git a/gitdb/fun.py b/gitdb/fun.py index 9e5c44a..ce55438 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -6,17 +6,28 @@ Keeping this code separate from the beginning makes it easier to out-source it into c later, if required""" -from exc import ( +from gitdb.exc import ( BadObjectType - ) +) -from util import zlib +from gitdb.util import zlib decompressobj = zlib.decompressobj import mmap -from itertools import islice, izip +from itertools import islice + +try: + from itertools import izip +except ImportError: + izip = zip -from cStringIO import StringIO +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO # INVARIANTS OFS_DELTA = 6 diff --git a/gitdb/pack.py b/gitdb/pack.py index 4a0badc..aea0d1e 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -4,31 +4,32 @@ # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Contains PackIndexFile and PackFile implementations""" from gitdb.exc import ( - BadObject, - UnsupportedOperation, - ParseError - ) -from util import ( - zlib, - mman, - LazyMixin, - unpack_from, - bin_to_hex, - ) + BadObject, + UnsupportedOperation, + ParseError +) -from fun import ( - create_pack_object_header, - pack_object_header_info, - is_equal_canonical_sha, - type_id_to_type_map, - write_object, - stream_copy, - chunk_size, - delta_types, - OFS_DELTA, - REF_DELTA, - msb_size - ) +from gitdb.util import ( + zlib, + mman, + LazyMixin, + unpack_from, + bin_to_hex, +) + +from gitdb.fun import ( + create_pack_object_header, + pack_object_header_info, + is_equal_canonical_sha, + type_id_to_type_map, + write_object, + stream_copy, + chunk_size, + delta_types, + OFS_DELTA, + REF_DELTA, + msb_size +) try: from _perf import PackIndexFile_sha_to_index @@ -36,22 +37,23 @@ except ImportError: pass # END try c module -from base import ( # Amazing ! - OInfo, - OStream, - OPackInfo, - OPackStream, - ODeltaStream, - ODeltaPackInfo, - ODeltaPackStream, - ) -from stream import ( - DecompressMemMapReader, - DeltaApplyReader, - Sha1Writer, - NullStream, - FlexibleSha1Writer - ) +from gitdb.base import ( # Amazing ! + OInfo, + OStream, + OPackInfo, + OPackStream, + ODeltaStream, + ODeltaPackInfo, + ODeltaPackStream, +) + +from gitdb.stream import ( + DecompressMemMapReader, + DeltaApplyReader, + Sha1Writer, + NullStream, + FlexibleSha1Writer +) from struct import ( pack, @@ -60,7 +62,11 @@ from struct import ( from binascii import crc32 -from itertools import izip +try: + from itertools import izip +except ImportError: + izip = zip + import tempfile import array import os @@ -200,7 +206,7 @@ class IndexWriter(object): for t in self._objs: tmplist[ord(t[0][0])] += 1 #END prepare fanout - for i in xrange(255): + for i in range(255): v = tmplist[i] sha_write(pack('>L', v)) tmplist[i+1] += v @@ -407,7 +413,7 @@ class PackIndexFile(LazyMixin): a.byteswap() return a else: - return tuple(self.offset(index) for index in xrange(self.size())) + return tuple(self.offset(index) for index in range(self.size())) # END handle version def sha_to_index(self, sha): @@ -694,7 +700,7 @@ class PackEntity(LazyMixin): """Iterate over all objects in our index and yield their OInfo or OStream instences""" _sha = self._index.sha _object = self._object - for index in xrange(self._index.size()): + for index in range(self._index.size()): yield _object(_sha(index), as_stream, index) # END for each index diff --git a/gitdb/stream.py b/gitdb/stream.py index b21c39c..52b54af 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -3,28 +3,35 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from cStringIO import StringIO +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO + import errno import mmap import os -from fun import ( - msb_size, - stream_copy, - apply_delta_data, - connect_deltas, - DeltaChunkList, - delta_types - ) - -from util import ( - allocate_memory, - LazyMixin, - make_sha, - write, - close, - zlib - ) +from gitdb.fun import ( + msb_size, + stream_copy, + apply_delta_data, + connect_deltas, + DeltaChunkList, + delta_types +) + +from gitdb.util import ( + allocate_memory, + LazyMixin, + make_sha, + write, + close, + zlib +) has_perf_mod = False try: diff --git a/gitdb/test/__init__.py b/gitdb/test/__init__.py index e84e503..ca104c0 100644 --- a/gitdb/test/__init__.py +++ b/gitdb/test/__init__.py @@ -9,7 +9,7 @@ import gitdb.util def _init_pool(): """Assure the pool is actually threaded""" size = 2 - print "Setting ThreadPool to %i" % size + print("Setting ThreadPool to %i" % size) gitdb.util.pool.set_size(size) diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index dc89039..18b22ff 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -23,7 +23,15 @@ from gitdb.exc import BadObject from gitdb.typ import str_blob_type from async import IteratorReader -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO + from struct import pack @@ -40,7 +48,7 @@ class TestDBBase(TestBase): # write a bunch of objects and query their streams and info null_objs = db.size() ni = 250 - for i in xrange(ni): + for i in range(ni): data = pack(">L", i) istream = IStream(str_blob_type, len(data), StringIO(data)) new_istream = db.store(istream) diff --git a/gitdb/test/db/test_git.py b/gitdb/test/db/test_git.py index 4894c6a..cce2b9c 100644 --- a/gitdb/test/db/test_git.py +++ b/gitdb/test/db/test_git.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.exc import BadObject from gitdb.db import GitDB from gitdb.base import OStream, OInfo diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index e295db5..5e42b63 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import LooseObjectDB from gitdb.exc import BadObject from gitdb.util import bin_to_hex diff --git a/gitdb/test/db/test_mem.py b/gitdb/test/db/test_mem.py index ac9bc34..9235b21 100644 --- a/gitdb/test/db/test_mem.py +++ b/gitdb/test/db/test_mem.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import ( MemoryDB, LooseObjectDB diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 0d9110a..f5a4dcb 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import PackedDB from gitdb.test.lib import fixture_path diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 0864468..752c31d 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import ReferenceDB from gitdb.util import ( diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index 685af2f..3ac7142 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -16,7 +16,14 @@ from gitdb.util import zlib import sys import random from array import array -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO import glob import unittest @@ -109,7 +116,7 @@ def make_bytes(size_in_bytes, randomize=False): """:return: string with given size in bytes :param randomize: try to produce a very random stream""" actual_size = size_in_bytes / 4 - producer = xrange(actual_size) + producer = range(actual_size) if randomize: producer = list(producer) random.shuffle(producer) diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 76b4d27..4cca7da 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -3,7 +3,7 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Test for object db""" -from lib import ( +from gitdb.test.lib import ( TestBase, DummyStream, DeriveTest, diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py index f45063b..f57cc50 100644 --- a/gitdb/test/test_example.py +++ b/gitdb/test/test_example.py @@ -3,12 +3,18 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Module with examples from the tutorial section of the docs""" -from lib import * +from gitdb.test.lib import * from gitdb import IStream from gitdb.db import LooseObjectDB from gitdb.util import pool - -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO from async import IteratorReader diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index f28aef4..bcda3cf 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -3,12 +3,13 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Test everything about packs reading and writing""" -from lib import ( - TestBase, - with_rw_directory, - with_packs_rw, - fixture_path - ) +from gitdb.test.lib import ( + TestBase, + with_rw_directory, + with_packs_rw, + fixture_path +) + from gitdb.stream import DeltaApplyReader from gitdb.pack import ( @@ -25,7 +26,13 @@ from gitdb.base import ( from gitdb.fun import delta_types from gitdb.exc import UnsupportedOperation from gitdb.util import to_bin_sha -from itertools import izip, chain +from itertools import chain + +try: + from itertools import izip +except ImportError: + izip = zip + from nose import SkipTest import os @@ -57,7 +64,7 @@ class TestPack(TestBase): assert len(index.offsets()) == size # get all data of all objects - for oidx in xrange(index.size()): + for oidx in range(index.size()): sha = index.sha(oidx) assert oidx == index.sha_to_index(sha) diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 8360ea3..53aa8e2 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -3,14 +3,14 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Test for object db""" -from lib import ( - TestBase, - DummyStream, - Sha1Writer, - make_bytes, - make_object, - fixture_path - ) +from gitdb.test.lib import ( + TestBase, + DummyStream, + Sha1Writer, + make_bytes, + make_object, + fixture_path +) from gitdb import * from gitdb.util import ( diff --git a/gitdb/test/test_util.py b/gitdb/test/test_util.py index ed69f0d..4672dd6 100644 --- a/gitdb/test/test_util.py +++ b/gitdb/test/test_util.py @@ -6,7 +6,7 @@ import tempfile import os -from lib import TestBase +from gitdb.test.lib import TestBase from gitdb.util import ( to_hex_sha, to_bin_sha, diff --git a/gitdb/util.py b/gitdb/util.py index b167b4d..3dcf3d7 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -8,13 +8,13 @@ import mmap import sys import errno -from cStringIO import StringIO - -# in py 2.4, StringIO is only StringI, without write support. -# Hence we must use the python implementation for this -if sys.version_info[1] < 5: - from StringIO import StringIO -# END handle python 2.4 +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO try: import async.mod.zlib as zlib @@ -303,7 +303,7 @@ class LockedFD(object): binary = getattr(os, 'O_BINARY', 0) lockmode = os.O_WRONLY | os.O_CREAT | os.O_EXCL | binary try: - fd = os.open(self._lockfilepath(), lockmode, 0600) + fd = os.open(self._lockfilepath(), lockmode, int("600", 8)) if not write: os.close(fd) else: @@ -372,7 +372,7 @@ class LockedFD(object): # assure others can at least read the file - the tmpfile left it at rw-- # We may also write that file, on windows that boils down to a remove- # protection as well - chmod(self._filepath, 0644) + chmod(self._filepath, int("644", 8)) else: # just delete the file so far, we failed os.remove(lockfile) |
