public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/, roverlay/util/
@ 2013-06-19 18:58 André Erdmann
  2013-06-19 18:59 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
  0 siblings, 1 reply; 2+ messages in thread
From: André Erdmann @ 2013-06-19 18:58 UTC (permalink / raw
  To: gentoo-commits

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 (...) ---


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/, roverlay/util/
  2013-06-19 18:58 [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/, roverlay/util/ André Erdmann
@ 2013-06-19 18:59 ` André Erdmann
  0 siblings, 0 replies; 2+ messages in thread
From: André Erdmann @ 2013-06-19 18:59 UTC (permalink / raw
  To: gentoo-commits

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 (...) ---


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-19 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 18:58 [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/, roverlay/util/ André Erdmann
2013-06-19 18:59 ` [gentoo-commits] proj/R_overlay:master " André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox