From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/, roverlay/util/
Date: Wed, 19 Jun 2013 18:59:05 +0000 (UTC) [thread overview]
Message-ID: <1371667552.8dfe62439f9e441b4eacceed058e3a4c86eb8610.dywi@gentoo> (raw)
Message-ID: <20130619185905.jylI5XHSSP_9RhPX_sFjbkzUcoYU7MB-dORGqNCChRg@z> (raw)
commit: 8dfe62439f9e441b4eacceed058e3a4c86eb8610
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 19 18:45:52 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> 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 <dywi@mailerd.de>
+# 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 <dywi@mailerd.de>
+# 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 <dywi@mailerd.de>
+# 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 (...) ---
next reply other threads:[~2013-06-19 18:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 18:58 André Erdmann [this message]
2013-06-19 18:59 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/, roverlay/util/ André Erdmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371667552.8dfe62439f9e441b4eacceed058e3a4c86eb8610.dywi@gentoo \
--to=dywi@mailerd.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox