Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 04/13] lint: convert funcs to @staticmethod where it makes sense
Date: Tue, 06 Oct 2015 15:05:46
Message-Id: 1444143929-26705-4-git-send-email-vapier@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import by Mike Frysinger
1 These functions don't actually utilize |self|, so make them into
2 @staticmethod's to quiet down the linter.
3 ---
4 catalyst/base/stagebase.py | 3 ++-
5 catalyst/lock.py | 9 ++++++---
6 catalyst/targets/snapshot.py | 3 ++-
7 3 files changed, 10 insertions(+), 5 deletions(-)
8
9 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
10 index b9dd1d5..409fcab 100644
11 --- a/catalyst/base/stagebase.py
12 +++ b/catalyst/base/stagebase.py
13 @@ -1695,7 +1695,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
14 self.unbind()
15 raise CatalystError("build aborting due to livecd_update error.")
16
17 - def _debug_pause_(self):
18 + @staticmethod
19 + def _debug_pause_():
20 py_input("press any key to continue: ")
21
22 # vim: ts=4 sw=4 sta et sts=4 ai
23 diff --git a/catalyst/lock.py b/catalyst/lock.py
24 index 71918d6..01b1aa8 100644
25 --- a/catalyst/lock.py
26 +++ b/catalyst/lock.py
27 @@ -320,7 +320,8 @@ class LockDir(object):
28 del self.hardlock_paths[self.lockdir]
29 print self.hardlock_paths
30
31 - def hardlock_name(self, path):
32 + @staticmethod
33 + def hardlock_name(path):
34 mypath=path+"/.hardlock-"+os.uname()[1]+"-"+str(os.getpid())
35 newpath = os.path.normpath(mypath)
36 if len(newpath) > 1:
37 @@ -328,7 +329,8 @@ class LockDir(object):
38 newpath = "/"+newpath.lstrip("/")
39 return newpath
40
41 - def hardlink_is_mine(self,link,lock):
42 + @staticmethod
43 + def hardlink_is_mine(link, lock):
44 import stat
45 try:
46 myhls = os.stat(link)
47 @@ -347,7 +349,8 @@ class LockDir(object):
48 return True
49 return False
50
51 - def hardlink_active(self, lock):
52 + @staticmethod
53 + def hardlink_active(lock):
54 if not os.path.exists(lock):
55 return False
56
57 diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
58 index 87340b7..a117a21 100644
59 --- a/catalyst/targets/snapshot.py
60 +++ b/catalyst/targets/snapshot.py
61 @@ -90,7 +90,8 @@ class snapshot(TargetBase, GenBase):
62 def kill_chroot_pids(self):
63 pass
64
65 - def cleanup(self):
66 + @staticmethod
67 + def cleanup():
68 print "Cleaning up..."
69
70 def purge(self):
71 --
72 2.5.2