[shellutils] don't use class decorator, we still need py 2.5 compat for some time. Closes #258060

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset6f1ad7bfec97
branchdefault
phasepublic
hiddenno
parent revision#aa16a1a4bae4 Added tag logilab-common-version-0.62.0, logilab-common-debian-version-0.62.0-1, logilab-common-centos-version-0.62.0-1 for changeset 4797b86b800e
child revision#941253222c52 graph: ensure we get predictable ordering
files modified by this revision
ChangeLog
shellutils.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1406277293 -7200
# Fri Jul 25 10:34:53 2014 +0200
# Node ID 6f1ad7bfec97cb4e1b059718995cb761c4df8611
# Parent aa16a1a4bae4e8cbc49ba44c3a9b6a71e0044872
[shellutils] don't use class decorator, we still need py 2.5 compat for some time. Closes #258060

diff --git a/ChangeLog b/ChangeLog
@@ -1,8 +1,11 @@
1  ChangeLog for logilab.common
2  ============================
3 
4 +--
5 +   * shellutils: restore py 2.5 compat by removing usage of class decorator
6 +
7  2014-03-07  --  0.62.0
8     * modutils: cleanup_sys_modules returns the list of cleaned modules
9 
10 
11  2014-02-11  --  0.61.0
diff --git a/shellutils.py b/shellutils.py
@@ -1,6 +1,6 @@
12 -# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
13 +# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
14  # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
15  #
16  # This file is part of logilab-common.
17  #
18  # logilab-common is free software: you can redistribute it and/or modify it under
@@ -224,21 +224,23 @@
19          else:
20              outfile = open(join(destdir, name), 'wb')
21              outfile.write(zfobj.read(name))
22              outfile.close()
23 
24 -@deprecated('Use subprocess.Popen instead')
25 +
26  class Execute:
27      """This is a deadlock safe version of popen2 (no stdin), that returns
28      an object with errorlevel, out and err.
29      """
30 
31      def __init__(self, command):
32          cmd = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
33          self.out, self.err = cmd.communicate()
34          self.status = os.WEXITSTATUS(cmd.returncode)
35 
36 +Execute = deprecated('Use subprocess.Popen instead')(Execute)
37 +
38 
39  def acquire_lock(lock_file, max_try=10, delay=10, max_delay=3600):
40      """Acquire a lock represented by a file on the file system
41 
42      If the process written in lock file doesn't exist anymore, we remove the