[elbe-devel] [PATCH 05/25] remove unused persistency.py

Manuel Traut manut at linutronix.de
Fri Dec 1 16:51:02 CET 2017


instead converting it to be py3 compatible

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 debian/elbe-buildenv.install |  1 -
 elbepack/persistency.py      | 74 --------------------------------------------
 2 files changed, 75 deletions(-)
 delete mode 100644 elbepack/persistency.py

diff --git a/debian/elbe-buildenv.install b/debian/elbe-buildenv.install
index 092e6597..527b3c66 100644
--- a/debian/elbe-buildenv.install
+++ b/debian/elbe-buildenv.install
@@ -24,7 +24,6 @@
 ./usr/lib/python2.*/*-packages/elbepack/debpkg.py
 ./usr/lib/python2.*/*-packages/elbepack/efilesystem.py
 ./usr/lib/python2.*/*-packages/elbepack/fstab.py
-./usr/lib/python2.*/*-packages/elbepack/persistency.py
 ./usr/lib/python2.*/*-packages/elbepack/rpcaptcache.py
 ./usr/lib/python2.*/*-packages/elbepack/updatepkg.py
 ./usr/lib/python2.*/*-packages/elbepack/pbuilder.py
diff --git a/elbepack/persistency.py b/elbepack/persistency.py
deleted file mode 100644
index ead6e5fb..00000000
--- a/elbepack/persistency.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# ELBE - Debian Based Embedded Rootfilesystem Builder
-# Copyright (C) 2013  Linutronix GmbH
-#
-# This file is part of ELBE.
-#
-# ELBE is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# ELBE is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-
-max_objects = 3
-
-from datetime import datetime
-
-class Managed(object):
-    cache = {}
-
-    @classmethod
-    def register(cls, obj):
-        if len(cls.cache.keys()) >= max_objects:
-            # LRU Logic here
-            minimal = cls.cache.keys()[0]
-            for i in cls.cache.keys():
-                if cls.cache[i].lastaccess < cls.cache[minimal].lastaccess:
-                    minimal = i
-            del cls.cache[minimal]
-        cls.cache[obj.path] = obj
-
-    def is_registered(self):
-        return hasattr(self,'path')
-
-    def __new__(cls,path):
-        if path in cls.cache:
-            inst = cls.cache[path]
-            inst.lastaccess = datetime.now()
-        else:
-            return object.__new__(cls)
-
-    def __init__(self, path):
-        if self.is_registered():
-            return
-
-        self.path = path
-        self.lastaccess = datetime.now()
-        self.register(self)
-
-
-class Derived(Managed):
-
-    def __init__(self,path):
-
-        # Init is called, even if we are coming from the cache
-        if self.is_registered():
-            return
-
-        Managed.__init__(self,path)
-
-        print "real init"
-        self.bla = "hello"
-
-    def __del__(self):
-        print "removing object ", self.path
-
-
-- 
2.15.1




More information about the elbe-devel mailing list