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 1D7AC138200 for ; Wed, 19 Jun 2013 18:58:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5E0E2E08F9; Wed, 19 Jun 2013 18:58:06 +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 D7FE3E08F9 for ; Wed, 19 Jun 2013 18:58:05 +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 79BA033E621 for ; Wed, 19 Jun 2013 18:58:04 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2682FE5462 for ; Wed, 19 Jun 2013 18:58:03 +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: <1371667552.8dfe62439f9e441b4eacceed058e3a4c86eb8610.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/, roverlay/util/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/util.py roverlay/util/__init__.py roverlay/util/common.py roverlay/util/py2.py roverlay/util/py3.py X-VCS-Directories: roverlay/ roverlay/util/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 8dfe62439f9e441b4eacceed058e3a4c86eb8610 X-VCS-Branch: gsoc13/next Date: Wed, 19 Jun 2013 18:58:03 +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: 29f4d2e9-cbea-4d67-8401-0bd810b8de2e X-Archives-Hash: b3aaefcf77842c37576cb08ad6fff502 commit: 8dfe62439f9e441b4eacceed058e3a4c86eb8610 Author: André Erdmann mailerd de> AuthorDate: Wed Jun 19 18:45:52 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 19 18:45:52 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8dfe6243 roverlay/: move util,py to util/common.py The util module consists of a common part and (python-)version-specific code now. --- roverlay/util/__init__.py | 19 +++++++++++++++++++ roverlay/{util.py => util/common.py} | 5 ++--- roverlay/util/py2.py | 11 +++++++++++ roverlay/util/py3.py | 12 ++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/roverlay/util/__init__.py b/roverlay/util/__init__.py new file mode 100644 index 0000000..77efd2a --- /dev/null +++ b/roverlay/util/__init__.py @@ -0,0 +1,19 @@ +# R overlay -- roverlay package, util +# -*- 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 roverlay.util.common import * + +import sys + +#if sys.hexversion >= 0x4000000: +# raise NotImplementedError() + +if sys.hexversion >= 0x3000000: + from roverlay.util.py3 import * +else: + from roverlay.util.py2 import * + +del sys diff --git a/roverlay/util.py b/roverlay/util/common.py similarity index 98% rename from roverlay/util.py rename to roverlay/util/common.py index b9d083e..d8ad4b7 100644 --- a/roverlay/util.py +++ b/roverlay/util/common.py @@ -7,11 +7,11 @@ """provides utility functions commonly used""" __all__= [ - 'dodir', 'keepenv', 'sysnop', 'get_dict_hash', 'priosort', - 'for_all_files' + 'dodir', 'for_all_files', 'get_dict_hash', 'keepenv', 'priosort', 'sysnop' ] import os +import sys import logging LOGGER = logging.getLogger ( 'util' ) @@ -85,7 +85,6 @@ def get_dict_hash ( kwargs ): ) # --- end of get_dict_hash (...) --- - def keepenv ( *to_keep ): """Selectively imports os.environ. diff --git a/roverlay/util/py2.py b/roverlay/util/py2.py new file mode 100644 index 0000000..ef73684 --- /dev/null +++ b/roverlay/util/py2.py @@ -0,0 +1,11 @@ +# R overlay -- roverlay util package, python2-specific functions +# -*- 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. + +__all__ = [ 'headtail', ] + +def headtail ( iterable ): + return ( iterable[0], iterable[1:] ) +# --- end of headtail #py2 (...) --- diff --git a/roverlay/util/py3.py b/roverlay/util/py3.py new file mode 100644 index 0000000..82083fb --- /dev/null +++ b/roverlay/util/py3.py @@ -0,0 +1,12 @@ +# R overlay -- roverlay util package, python3-specific functions +# -*- 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. + +__all__ = [ 'headtail', ] + +def headtail ( iterable ): + head, *tail = iterable + return ( head, tail ) +# --- end of headtail #py3 (...) --- 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 CD60E1381F4 for ; Wed, 19 Jun 2013 18:59:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 51FDBE0801; Wed, 19 Jun 2013 18:59:08 +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 A4C50E0801 for ; Wed, 19 Jun 2013 18:59:07 +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 886F833E617 for ; Wed, 19 Jun 2013 18:59:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3A640E5462 for ; Wed, 19 Jun 2013 18:59:05 +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: <1371667552.8dfe62439f9e441b4eacceed058e3a4c86eb8610.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/, roverlay/util/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/util.py roverlay/util/__init__.py roverlay/util/common.py roverlay/util/py2.py roverlay/util/py3.py X-VCS-Directories: roverlay/ roverlay/util/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 8dfe62439f9e441b4eacceed058e3a4c86eb8610 X-VCS-Branch: master Date: Wed, 19 Jun 2013 18:59:05 +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: 3c0926c2-5c77-4c15-9c1e-8dec3d07951e X-Archives-Hash: 09d1fda97214a053512c1bf5e7c21d05 Message-ID: <20130619185905.jylI5XHSSP_9RhPX_sFjbkzUcoYU7MB-dORGqNCChRg@z> commit: 8dfe62439f9e441b4eacceed058e3a4c86eb8610 Author: André Erdmann mailerd de> AuthorDate: Wed Jun 19 18:45:52 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 19 18:45:52 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8dfe6243 roverlay/: move util,py to util/common.py The util module consists of a common part and (python-)version-specific code now. --- roverlay/util/__init__.py | 19 +++++++++++++++++++ roverlay/{util.py => util/common.py} | 5 ++--- roverlay/util/py2.py | 11 +++++++++++ roverlay/util/py3.py | 12 ++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/roverlay/util/__init__.py b/roverlay/util/__init__.py new file mode 100644 index 0000000..77efd2a --- /dev/null +++ b/roverlay/util/__init__.py @@ -0,0 +1,19 @@ +# R overlay -- roverlay package, util +# -*- 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 roverlay.util.common import * + +import sys + +#if sys.hexversion >= 0x4000000: +# raise NotImplementedError() + +if sys.hexversion >= 0x3000000: + from roverlay.util.py3 import * +else: + from roverlay.util.py2 import * + +del sys diff --git a/roverlay/util.py b/roverlay/util/common.py similarity index 98% rename from roverlay/util.py rename to roverlay/util/common.py index b9d083e..d8ad4b7 100644 --- a/roverlay/util.py +++ b/roverlay/util/common.py @@ -7,11 +7,11 @@ """provides utility functions commonly used""" __all__= [ - 'dodir', 'keepenv', 'sysnop', 'get_dict_hash', 'priosort', - 'for_all_files' + 'dodir', 'for_all_files', 'get_dict_hash', 'keepenv', 'priosort', 'sysnop' ] import os +import sys import logging LOGGER = logging.getLogger ( 'util' ) @@ -85,7 +85,6 @@ def get_dict_hash ( kwargs ): ) # --- end of get_dict_hash (...) --- - def keepenv ( *to_keep ): """Selectively imports os.environ. diff --git a/roverlay/util/py2.py b/roverlay/util/py2.py new file mode 100644 index 0000000..ef73684 --- /dev/null +++ b/roverlay/util/py2.py @@ -0,0 +1,11 @@ +# R overlay -- roverlay util package, python2-specific functions +# -*- 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. + +__all__ = [ 'headtail', ] + +def headtail ( iterable ): + return ( iterable[0], iterable[1:] ) +# --- end of headtail #py2 (...) --- diff --git a/roverlay/util/py3.py b/roverlay/util/py3.py new file mode 100644 index 0000000..82083fb --- /dev/null +++ b/roverlay/util/py3.py @@ -0,0 +1,12 @@ +# R overlay -- roverlay util package, python3-specific functions +# -*- 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. + +__all__ = [ 'headtail', ] + +def headtail ( iterable ): + head, *tail = iterable + return ( head, tail ) +# --- end of headtail #py3 (...) ---