From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4E3101381F3 for ; Fri, 20 Sep 2013 15:57:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 20516E09E0; Fri, 20 Sep 2013 15:57:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AB8BBE09B2 for ; Fri, 20 Sep 2013 15:57:25 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B96FA33EB44 for ; Fri, 20 Sep 2013 15:57:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 6CFF9E530A for ; Fri, 20 Sep 2013 15:57:23 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1379688387.3ef843db7ccbdaecf9cab4fb4809ca99dec566e5.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/util/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/util/_abc2.py roverlay/util/_abc3.py roverlay/util/objects.py X-VCS-Directories: roverlay/util/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 3ef843db7ccbdaecf9cab4fb4809ca99dec566e5 X-VCS-Branch: master Date: Fri, 20 Sep 2013 15:57:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7cdfec72-60c5-424d-a114-dc984bcb6ef6 X-Archives-Hash: d2fd2c1c164d3b2c3997e5b732d77049 commit: 3ef843db7ccbdaecf9cab4fb4809ca99dec566e5 Author: André Erdmann mailerd de> AuthorDate: Fri Sep 20 14:46:27 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Sep 20 14:46:27 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=3ef843db roverlay/util: python 2/3 wrapper for abc.ABCMeta --- roverlay/util/_abc2.py | 13 +++++++++++++ roverlay/util/_abc3.py | 13 +++++++++++++ roverlay/util/objects.py | 10 +++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/roverlay/util/_abc2.py b/roverlay/util/_abc2.py new file mode 100644 index 0000000..830ab8f --- /dev/null +++ b/roverlay/util/_abc2.py @@ -0,0 +1,13 @@ +# R overlay -- compat module for creating abstract classes (python 2) +# -*- coding: utf-8 -*- +# Copyright (C) 2013 André Erdmann +# Distributed under the terms of the GNU General Public License; +# either version 2 of the License, or (at your option) any later version. + +from abc import ABCMeta, abstractmethod + +__all__ = [ 'abstractmethod', 'AbstractObject', ] + +class AbstractObject ( object ): + __metaclass__ = ABCMeta +# --- end of AbstractObject --- diff --git a/roverlay/util/_abc3.py b/roverlay/util/_abc3.py new file mode 100644 index 0000000..bcf0b0e --- /dev/null +++ b/roverlay/util/_abc3.py @@ -0,0 +1,13 @@ +# R overlay -- compat module for creating abstract classes (python 3) +# -*- coding: utf-8 -*- +# Copyright (C) 2013 André Erdmann +# Distributed under the terms of the GNU General Public License; +# either version 2 of the License, or (at your option) any later version. + +from abc import ABCMeta, abstractmethod + +__all__ = [ 'abstractmethod', 'AbstractObject', ] + +class AbstractObject ( object, metaclass=ABCMeta ): + pass +# --- end of AbstractObject --- diff --git a/roverlay/util/objects.py b/roverlay/util/objects.py index 5ba2d69..d14733e 100644 --- a/roverlay/util/objects.py +++ b/roverlay/util/objects.py @@ -5,8 +5,16 @@ # either version 2 of the License, or (at your option) any later version. import weakref +import sys -__all__ = [ 'get_object_ref', 'abstractmethod', 'not_implemented', ] +if sys.hexversion >= 0x3000000: + from ._abc3 import AbstractObject +else: + from ._abc2 import AbstractObject + +__all__ = [ + 'get_object_ref', 'abstractmethod', 'not_implemented', 'AbstractObject', +] class ObjectDisappeared ( Exception ):