public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
Date: Thu, 11 Jul 2013 16:44:20 +0000 (UTC)	[thread overview]
Message-ID: <1373560925.f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1.dywi@gentoo> (raw)

commit:     f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 16:42:05 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 16:42:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f7829a4b

roverlay/depres/depenv: split ANDed dependency str

Dependency strings containing an '<whitespace>and<whitespace>' will now be
splitted, and each part is resolved individually.

Note that this "breaks" some of the existing dependency rules.

---
 roverlay/depres/depenv.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 277290c..7455360 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -114,6 +114,8 @@ class DepEnv ( object ):
    FIXVERSION_REGEX = re.compile ( '[_\-]' )
    URI_PURGE        = re.compile ( '\s*from\s*(http|ftp|https)://[^\s]+' )
    WHITESPACE       = re.compile ( '\s+' )
+   #AND_SPLIT        = re.compile ( '\s+and\s+|\s+&&\s+', flags=re.IGNORECASE )
+   AND_SPLIT        = re.compile ( '\s+and\s+', flags=re.IGNORECASE )
 
    # try all version regexes if True, else break after first match
    TRY_ALL_REGEXES  = False
@@ -124,22 +126,27 @@ class DepEnv ( object ):
 
    @classmethod
    def from_str ( cls, dep_str, deptype_mask ):
-      """(Pre-)parses a dependency string and creates DepEnv objects for it."""
+      """Generator that (pre-)parses a dependency string and creates
+      DepEnv objects for it.
+
+      arguments:
+      * dep_str      --
+      * deptype_mask --
+      """
       # split dep_str into logically ANDed dependency strings,
       # unquote them, remove "from <uri>.." entries and replace all
       # whitespace by a single ' ' char
-      return (
-         cls (
+      for substring in cls.AND_SPLIT.split ( dep_str ):
+         yield cls (
             dep_str = (
                cls.WHITESPACE.sub ( ' ',
                   cls.URI_PURGE.sub ( '',
-                     strutil.unquote ( dep_str )
+                     strutil.unquote ( substring )
                   )
                ).strip()
             ),
             deptype_mask = deptype_mask,
-         ),
-      )
+         )
    # --- end of from_str (...) ---
 
    def __init__ ( self, dep_str, deptype_mask ):


WARNING: multiple messages have this Message-ID (diff)
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/
Date: Thu, 11 Jul 2013 16:44:20 +0000 (UTC)	[thread overview]
Message-ID: <1373560925.f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1.dywi@gentoo> (raw)
Message-ID: <20130711164420.OltZN9or6bu_Yq9gtkdcHcy3AJbHpoIRH4b3L51onHU@z> (raw)

commit:     f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 16:42:05 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 16:42:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f7829a4b

roverlay/depres/depenv: split ANDed dependency str

Dependency strings containing an '<whitespace>and<whitespace>' will now be
splitted, and each part is resolved individually.

Note that this "breaks" some of the existing dependency rules.

---
 roverlay/depres/depenv.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 277290c..7455360 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -114,6 +114,8 @@ class DepEnv ( object ):
    FIXVERSION_REGEX = re.compile ( '[_\-]' )
    URI_PURGE        = re.compile ( '\s*from\s*(http|ftp|https)://[^\s]+' )
    WHITESPACE       = re.compile ( '\s+' )
+   #AND_SPLIT        = re.compile ( '\s+and\s+|\s+&&\s+', flags=re.IGNORECASE )
+   AND_SPLIT        = re.compile ( '\s+and\s+', flags=re.IGNORECASE )
 
    # try all version regexes if True, else break after first match
    TRY_ALL_REGEXES  = False
@@ -124,22 +126,27 @@ class DepEnv ( object ):
 
    @classmethod
    def from_str ( cls, dep_str, deptype_mask ):
-      """(Pre-)parses a dependency string and creates DepEnv objects for it."""
+      """Generator that (pre-)parses a dependency string and creates
+      DepEnv objects for it.
+
+      arguments:
+      * dep_str      --
+      * deptype_mask --
+      """
       # split dep_str into logically ANDed dependency strings,
       # unquote them, remove "from <uri>.." entries and replace all
       # whitespace by a single ' ' char
-      return (
-         cls (
+      for substring in cls.AND_SPLIT.split ( dep_str ):
+         yield cls (
             dep_str = (
                cls.WHITESPACE.sub ( ' ',
                   cls.URI_PURGE.sub ( '',
-                     strutil.unquote ( dep_str )
+                     strutil.unquote ( substring )
                   )
                ).strip()
             ),
             deptype_mask = deptype_mask,
-         ),
-      )
+         )
    # --- end of from_str (...) ---
 
    def __init__ ( self, dep_str, deptype_mask ):


             reply	other threads:[~2013-07-11 16:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 16:44 André Erdmann [this message]
2013-07-11 16:44 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2013-07-18 19:25 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-17 18:10 André Erdmann
2013-07-16 16:36 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-15 22:31 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-15 22:31 André Erdmann
2013-07-11  8:49 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11  8:45 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-05 16:55 André Erdmann
2013-07-05 16:55 André Erdmann
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:gsoc13/next " 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=1373560925.f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1.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