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

Torben Hohn torben.hohn at linutronix.de
Tue Dec 5 17:45:23 CET 2017


On Fri, Dec 01, 2017 at 04:51:02PM +0100, Manuel Traut wrote:
> instead converting it to be py3 compatible

> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>

Reviewed-by: Torben Hohn <torbenh 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171205/77c82638/attachment.sig>


More information about the elbe-devel mailing list