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:master commit in: roverlay/rpackage/
Date: Thu, 25 Jul 2013 08:47:43 +0000 (UTC)	[thread overview]
Message-ID: <1374741999.5a33555ed99796d0277466e2e7009f9eae2f1d35.dywi@gentoo> (raw)

commit:     5a33555ed99796d0277466e2e7009f9eae2f1d35
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 25 08:46:39 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 25 08:46:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5a33555e

rpackage/descriptionreader: parse files directly

For testing.

---
 roverlay/rpackage/descriptionreader.py | 54 ++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 15 deletions(-)

diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index f18aa15..b589489 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -13,6 +13,7 @@ import sys
 import tarfile
 import os.path
 import time
+import logging
 
 from roverlay          import config, util, strutil
 from roverlay.rpackage import descriptionfields
@@ -68,6 +69,28 @@ class DescriptionReader ( object ):
 
    # --- end of __init__ (...) ---
 
+   def parse_file ( self, filepath ):
+      desc_lines = self._get_desc_from_file ( filepath )
+      if desc_lines is None:
+         return None
+      else:
+         raw_data  = self._get_raw_data ( desc_lines )
+         read_data = self._make_read_data ( raw_data )
+         if read_data is None:
+            return None
+         else:
+            return ( self._verify_read_data ( read_data ), read_data )
+   # --- end of parse_file (...) ---
+
+   @classmethod
+   def parse_files ( cls, *filepaths ):
+      instance = cls (
+         None, logging.getLogger(), read_now=False, write_desc=False
+      )
+      for filepath in filepaths:
+         yield instance.parse_file ( filepath )
+   # --- end of parse_files (...) ---
+
    def get_desc ( self, run_if_unset=True ):
       if not hasattr ( self, 'desc_data' ):
          if run_if_unset:
@@ -272,19 +295,7 @@ class DescriptionReader ( object ):
 
    # --- end of _get_desc_from_file (...) ---
 
-   def _get_raw_data ( self ):
-      try:
-         desc_lines = self._get_desc_from_file (
-            self.fileinfo ['package_file'],
-            self.fileinfo ['package_name']
-         )
-
-      except Exception as err:
-         #self.logger.exception ( err )
-         # error message should suffice
-         self.logger.warning ( err )
-         return None
-
+   def _get_raw_data ( self, desc_lines ):
       raw = dict()
 
       field_context = None
@@ -432,9 +443,22 @@ class DescriptionReader ( object ):
       are "useless" (not suited to create an ebuild for it,
       e.g. if OS_TYPE is not unix).
       """
+      read_data = None
+      try:
+         desc_lines = self._get_desc_from_file (
+            self.fileinfo ['package_file'],
+            self.fileinfo ['package_name']
+         )
+      except Exception as err:
+         #self.logger.exception ( err )
+         # error message should suffice
+         self.logger.warning ( err )
+      else:
+         if desc_lines is not None:
+            raw_data  = self._get_raw_data ( desc_lines )
+            read_data = self._make_read_data ( raw_data )
+
 
-      raw_data  = self._get_raw_data()
-      read_data = self._make_read_data ( raw_data )
 
       self.desc_data = None
 


             reply	other threads:[~2013-07-25  8:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25  8:47 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-16  1:35 [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/ Benda XU
2013-08-21 13:51 André Erdmann
2013-08-21 13:51 André Erdmann
2013-08-20 21:46 André Erdmann
2013-07-25 13:28 André Erdmann
2013-07-25 13:25 André Erdmann
2013-07-25  8:47 André Erdmann
2013-07-23 18:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 18:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11 16:29 André Erdmann
2013-04-25 16:44 André Erdmann
2013-02-09 20:45 André Erdmann
2012-08-07  8:50 André Erdmann
2012-07-30  8:52 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-03 17:48 André Erdmann
2012-07-02 16:52 André Erdmann
2012-06-29 22:48 André Erdmann
2012-06-28 15:55 André Erdmann
2012-06-28 15:55 André Erdmann
2012-06-27 14:46 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=1374741999.5a33555ed99796d0277466e2e7009f9eae2f1d35.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