* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-06-27 14:46 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-06-27 14:46 UTC (permalink / raw
To: gentoo-commits
commit: b9d2ce16ef0cd0ce538e838139e7783cf6cd54c7
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 27 14:46:09 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun 27 14:46:09 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b9d2ce16
unused import removed
---
roverlay/rpackage/descriptionreader.py | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index c9daeb8..03ec30a 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -4,7 +4,6 @@
import re
import tarfile
-import logging
import os.path
from roverlay import config
@@ -13,9 +12,6 @@ from roverlay.rpackage import descriptionfields
class DescriptionReader ( object ):
"""Description Reader"""
- #LOGGER = logging.getLogger ( 'DescriptionReader' )
-
-
def __init__ ( self, package_info, logger, read_now=False ):
"""Initializes a DESCRIPTION file reader."""
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-06-28 15:55 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-06-28 15:55 UTC (permalink / raw
To: gentoo-commits
commit: e66efe48672dc9ad463df7d3d842ae08e20bedd6
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 28 15:48:00 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 28 15:48:00 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e66efe48
use sets/tuples instead of lists
---
roverlay/rpackage/descriptionfields.py | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/roverlay/rpackage/descriptionfields.py b/roverlay/rpackage/descriptionfields.py
index dcb0803..148b757 100644
--- a/roverlay/rpackage/descriptionfields.py
+++ b/roverlay/rpackage/descriptionfields.py
@@ -291,10 +291,10 @@ class DescriptionFields ( object ):
"""Scans all stored DescriptionField(s) and creates fast-accessible
data to be used in get_fields_with_<sth> (...).
"""
- flagmap = dict ()
+ flagmap = dict()
optionmap = dict (
- defaults = dict (),
- allowed_values = list ()
+ defaults = dict(),
+ allowed_values = set()
)
for field_name in self.fields.keys():
@@ -303,12 +303,12 @@ class DescriptionFields ( object ):
optionmap ['defaults'] [field_name] = d
if self.fields [field_name].allowed_values:
- optionmap ['allowed_values'].append ( field_name )
+ optionmap ['allowed_values'].add ( field_name )
for flag in self.fields [field_name].flags:
if not flag in flagmap:
- flagmap [flag] = list ()
- flagmap [flag].append ( field_name )
+ flagmap [flag] = set()
+ flagmap [flag].add ( field_name )
self._fields_by_flag = flagmap
self._fields_by_option = optionmap
@@ -331,7 +331,7 @@ class DescriptionFields ( object ):
if flag in self._fields_by_flag:
return self._fields_by_flag [flag]
else:
- return []
+ return ()
# --- end of get_fields_with_flag (...) ---
@@ -349,7 +349,7 @@ class DescriptionFields ( object ):
if option in self._fields_by_option:
return self._fields_by_option [option]
else:
- return []
+ return ()
# --- end of get_field_with_option (...) ---
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-06-28 15:55 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-06-28 15:55 UTC (permalink / raw
To: gentoo-commits
commit: 4d7bcbfae3c037d56ac315c393bd9b30cf57a37b
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 28 15:51:53 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 28 15:51:53 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=4d7bcbfa
fix for description reader
* read field lines as one string and parse it after reading
this fixes reading entries like <<
Depends: a (>1.0) b
(>0.9) c
>>
that should be read as {'Depends':('a (>1.0)','b (>0.9)','c')}
and _not_ as {'Depends':('a (>1.0)','b','(>0.9)','c')}
modified: roverlay/rpackage/descriptionreader.py
---
roverlay/rpackage/descriptionreader.py | 368 +++++++++++++++++---------------
1 files changed, 197 insertions(+), 171 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 8aa35b3..1f6bd3e 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -10,12 +10,31 @@ import time
from roverlay import config, util
from roverlay.rpackage import descriptionfields
+def make_desc_packageinfo ( filepath ):
+ """Creates a minimal dict that can be used as package info in the
+ DescriptionReader (for testing/debugging).
+
+ arguments:
+ * filepath --
+ """
+ name, sep, ver = filepath.partition ( '_' )
+ return dict (
+ package_file = filepath,
+ package_name = name,
+ ebuild_verstr = ver,
+ name = name,
+ )
+
+
class DescriptionReader ( object ):
"""Description Reader"""
WRITE_DESCFILES_DIR = config.get ( 'DESCRIPTION.descfiles_dir', None )
- def __init__ ( self, package_info, logger, read_now=False ):
+ def __init__ ( self,
+ package_info, logger,
+ read_now=False, write_desc=True
+ ):
"""Initializes a DESCRIPTION file reader."""
if not config.access().get_field_definition():
@@ -26,9 +45,8 @@ class DescriptionReader ( object ):
self.field_definition = config.access().get_field_definition()
self.fileinfo = package_info
self.logger = logger.getChild ( 'desc_reader' )
- self.desc_data = None
- if DescriptionReader.WRITE_DESCFILES_DIR is not None:
+ if write_desc and DescriptionReader.WRITE_DESCFILES_DIR is not None:
self.write_desc_file = os.path.join (
DescriptionReader.WRITE_DESCFILES_DIR,
'%s_%s.desc' % (
@@ -36,72 +54,114 @@ class DescriptionReader ( object ):
)
)
-
if read_now:
self.run()
# --- end of __init__ (...) ---
def get_desc ( self, run_if_unset=True ):
- if self.desc_data is None:
- self.run ()
+ if not hasattr ( self, 'desc_data' ):
+ if run_if_unset:
+ self.run()
+ else:
+ raise Exception ( "no desc data" )
return self.desc_data
# --- end of get_desc (...) ---
- def _parse_read_data ( self, read_data ):
- """Verifies and parses/fixes read data.
+ def _make_read_data ( self, raw ):
+ """Create read data (value or list of values per field) for the given
+ raw data (list of text lines per field).
arguments:
- * read_data -- data from file, will be modified
+ * raw --
+
+ returns: read data
"""
+ # catch None
+ if raw is None: return None
+
+ # this dict will be returned as result later
+ read = dict()
+
+ flags = self.field_definition.get_fields_with_flag
# insert default values
default_values = self.field_definition.get_fields_with_default_value()
for field_name in default_values.keys():
- if not field_name in read_data:
- read_data [field_name] = default_values [field_name]
+ if not field_name in raw:
+ read [field_name] = default_values [field_name]
+
+
+ # transfer fields from raw as string or list
+ fields_join = flags ( 'joinValues' )
+ fields_isList = flags ( 'isList' )
+ fields_wsList = flags ( 'isWhitespaceList' )
+
+ list_split = re.compile (
+ config.get_or_fail ( 'DESCRIPTION.list_split_regex' )
+ ).split
+ slist_split = re.compile ( '\s+' ).split
+
+ make_list = lambda l : tuple ( filter ( None, list_split ( l, 0 ) ) )
+ make_slist = lambda l : tuple ( filter ( None, slist_split ( l, 0 ) ) )
+
+ for field in raw.keys():
+ value_line = ' '.join ( filter ( None, raw [field] ) )
+
+ # join > isList > wsList [... >= join (implicit)]
+
+ if field in fields_join:
+ read [field] = value_line
+
+ elif field in fields_isList:
+ read [field] = make_list ( value_line )
+
+ elif field in fields_wsList:
+ read [field] = make_slist ( value_line )
+
+ else:
+ read [field] = value_line
- # join values to a single string
- for field_name in \
- self.field_definition.get_fields_with_flag ( 'joinValues' ) \
- :
- if field_name in read_data:
- read_data [field_name] = ' ' . join ( read_data [field_name] )
+ return read
+ # --- end of _make_read_data (...) ---
+
+ def _verify_read_data ( self, read ):
+ """Verifies read data.
+ Checks that all mandatory fields are set and all fields have suitable
+ values.
+
+ Returns True (^= valid data) or False (^= cannot use package)
+ """
+ fref = self.field_definition
# ensure that all mandatory fields are set
missing_fields = set ()
- for field_name in \
- self.field_definition.get_fields_with_flag ( 'mandatory' ):
+ for field in fref.get_fields_with_flag ( 'mandatory' ):
- if field_name in read_data:
- if read_data [field_name] is None or \
- len ( read_data [field_name] ) < 1 \
- :
- missing_fields.add ( field_name )
+ if field in read:
+ if read [field] is None or len ( read [field] ) < 1:
+ missing_fields.add ( field )
#else: ok
else:
- missing_fields.add ( field_name )
+ missing_fields.add ( field )
# check for fields that allow only certain values
unsuitable_fields = set()
- restricted_fields = \
- self.field_definition.get_fields_with_allowed_values()
+ restricted_fields = fref.get_fields_with_allowed_values()
- for field_name in restricted_fields:
- if field_name in read_data:
- if not self.field_definition.get ( field_name ) . value_allowed (
- read_data [field_name]
- ):
- unsuitable_fields.add ( field_name )
+ for field in restricted_fields:
+ if field in read:
+ if not fref.get ( field ).value_allowed ( read [field] ):
+ unsuitable_fields.add ( field )
# summarize results
- valid = not bool ( len ( missing_fields ) or len ( unsuitable_fields ) )
+ valid = not len ( missing_fields ) and not len ( unsuitable_fields )
if not valid:
self.logger.info ( "Cannot use R package" ) # name?
if len ( missing_fields ):
@@ -117,149 +177,87 @@ class DescriptionReader ( object ):
return valid
- # --- end of _parse_read_data (...) ---
+ # --- end of _verify_read_data (...) ---
- def run ( self ):
- """Reads a DESCRIPTION file and returns the read data if successful,
- else None.
+ def _get_desc_from_file ( self, filepath, pkg_name='.' ):
+ """Reads a file returns the description data.
arguments:
- * file -- path to the tarball file (containing the description file)
- that should be read
+ * filepath -- file to read (str; path to tarball or file)
+ * pkg_name -- name of the package, in tarballs the description file
+ is located in <pkg_name>/ and thus this argument
+ is required. Defaults to '.', set to None to disable.
+
+ All exceptions are passed to the caller (TarError, IOErr, <custom>).
+ <filepath> can either be a tarball in which case the real DESCRIPTION
+ file is read (<pkg_name>/DESCRIPTION) or a normal file.
+ """
- It does some pre-parsing, inter alia
- -> assigning field identifiers from the file to real field names
- -> split field values
- -> filter out unwanted/useless fields
+ self.logger.debug ( "Starting to read file '%s' ...\n" % filepath )
- The return value is a description_data dict or None if the read data
- are "useless" (not suited to create an ebuild for it,
- e.g. if OS_TYPE is not unix).
- """
+ if not ( isinstance ( filepath, str ) and filepath ):
+ raise Exception ( "bad usage" )
- def make_values ( value_str, field_context=None ):
- """Extracts relevant data from value_str and returns them as list.
-
- arguments:
- * value_str -- string that represents the (just read) values
- * field_context -- field name the value belongs to;
- optional, defaults to None
-
- It's useful to set field_context 'cause several fields ('Depends')
- have multiple values arranged in a list (dep0, dep1 [, depK]*).
- """
-
- svalue_str = value_str.strip()
-
- if not svalue_str:
- # empty value(s)
- return []
-
- elif field_context is None:
- # default return if no context given
- return [ svalue_str ]
-
- elif field_context in \
- self.field_definition.get_fields_with_flag ( 'isList' ) \
- :
- # split up this list (separated by commata and/or semicolons)
- # *beware*/fixme: py3, filter returns filter object
- return filter ( None, re.split (
- config.get ( 'DESCRIPTION.list_split_regex' ),
- svalue_str,
- 0
- ) )
-
- elif field_context in \
- self.field_definition.get_fields_with_flag ( 'isWhitespaceList' ) \
- :
- # split up this list (separated by whitespace)
- return filter ( None, re.split ( '\s+', svalue_str, 0 ) )
-
- # default return
- return [ svalue_str ]
-
- # --- end of make_values (...) ---
-
- def get_desc_from_file ( filepath, pkg_name='.' ):
- """Reads a file returns the description data.
-
- arguments:
- * filepath -- file to read (str; path to tarball or file)
- * pkg_name -- name of the package, in tarballs the description file
- is located in <pkg_name>/ and thus this argument
- is required. Defaults to '.', set to None to disable.
-
- All exceptions are passed to the caller (TarError, IOErr, <custom>).
- <filepath> can either be a tarball in which case the real DESCRIPTION
- file is read (<pkg_name>/DESCRIPTION) or a normal file.
- """
-
- self.logger.debug ( "Starting to read file '%s' ...\n" % filepath )
-
- if not ( isinstance ( filepath, str ) and filepath ):
- raise Exception ( "bad usage" )
-
- # read describes how to import the lines from a file (e.g. rstrip())
- # fh, th are file/tar handles
- read = th = fh = None
-
- if tarfile.is_tarfile ( filepath ):
- # filepath is a tarball, open tar handle + file handle
- th = tarfile.open ( filepath, 'r' )
- if pkg_name:
- fh = th.extractfile ( os.path.join (
- pkg_name,
- config.get ( 'DESCRIPTION.file_name' )
- ) )
- else:
- fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
+ # read describes how to import the lines from a file (e.g. rstrip())
+ # fh, th are file/tar handles
+ read = th = fh = None
- # have to decode the lines
- read = lambda lines : [ line.decode().rstrip() for line in lines ]
+ if tarfile.is_tarfile ( filepath ):
+ # filepath is a tarball, open tar handle + file handle
+ th = tarfile.open ( filepath, 'r' )
+ if pkg_name:
+ fh = th.extractfile ( os.path.join (
+ pkg_name,
+ config.get ( 'DESCRIPTION.file_name' )
+ ) )
else:
- # open file handle only
- fh = open ( filepath, 'r' )
- read = lambda lines : [ line.rstrip() for line in lines ]
-
- x = None
- read_lines = read ( fh.readlines() )
- del x, read
-
- fh.close()
- if not th is None: th.close()
- del fh, th
-
- if hasattr ( self, 'write_desc_file' ):
- try:
- util.dodir ( DescriptionReader.WRITE_DESCFILES_DIR )
- fh = open ( self.write_desc_file, 'w' )
- fh.write (
- '=== This is debug output (%s) ===\n'
- % time.strftime ( '%F %H:%M:%S' )
- )
- fh.write ( '\n'.join ( read_lines ) )
- fh.write ( '\n' )
- finally:
- if 'fh' in locals() and fh: fh.close()
-
+ fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
+
+ # have to decode the lines
+ read = lambda lines : [ line.decode().rstrip() for line in lines ]
+ else:
+ # open file handle only
+ fh = open ( filepath, 'r' )
+ read = lambda lines : [ line.rstrip() for line in lines ]
+
+ x = None
+ read_lines = read ( fh.readlines() )
+ del x, read
+
+ fh.close()
+ if not th is None: th.close()
+ del fh, th
+
+ if hasattr ( self, 'write_desc_file' ):
+ try:
+ util.dodir ( DescriptionReader.WRITE_DESCFILES_DIR )
+ fh = open ( self.write_desc_file, 'w' )
+ fh.write (
+ '=== This is debug output (%s) ===\n'
+ % time.strftime ( '%F %H:%M:%S' )
+ )
+ fh.write ( '\n'.join ( read_lines ) )
+ fh.write ( '\n' )
+ finally:
+ if 'fh' in locals() and fh: fh.close()
- return read_lines
- # --- end of get_desc_from_file (...) ---
+ return read_lines
- self.desc_data = None
- read_data = dict ()
+ # --- end of _get_desc_from_file (...) ---
+ def _get_raw_data ( self ):
try:
- desc_lines = get_desc_from_file (
+ desc_lines = self._get_desc_from_file (
self.fileinfo ['package_file'],
self.fileinfo ['package_name']
)
- except IOError as err:
+ except Exception as err:
self.logger.exception ( err )
- return self.desc_data
+ return None
+
+ raw = dict()
field_context = None
@@ -281,8 +279,8 @@ class DescriptionReader ( object ):
if field_context:
# context is set => append values
- for val in make_values ( sline, field_context ):
- read_data [field_context] . append ( val )
+ raw [field_context].append ( sline )
+
else:
# no valid context => ignore line
pass
@@ -292,7 +290,7 @@ class DescriptionReader ( object ):
field_context = None
line_components = sline.partition (
- config.get ( 'DESCRIPTION.field_separator' )
+ config.get ( 'DESCRIPTION.field_separator', ':' )
)
if line_components [1]:
@@ -319,15 +317,13 @@ class DescriptionReader ( object ):
'already been catched in DescriptionField...'
)
- # create a new empty list for this field_context
- read_data [field_context] = []
+ if field_context in raw:
+ raise Exception ( "field %s exists!" % field_context )
# add values to read_data, no need to check
# line_components [2] 'cause [1] was a true str
- for val in \
- make_values ( line_components [2], field_context ) \
- :
- read_data [field_context] . append ( val )
+ # create a new empty list for this field_context
+ raw[field_context] = [ line_components [2].lstrip() ]
else:
# reaching this branch means that
@@ -341,14 +337,44 @@ class DescriptionReader ( object ):
# -- end for --
- if self._parse_read_data ( read_data ):
+ return raw
+ # --- end of _get_raw_data (...) ---
+
+ def run ( self ):
+ """Reads a DESCRIPTION file and returns the read data if successful,
+ else None.
+
+ arguments:
+ * file -- path to the tarball file (containing the description file)
+ that should be read
+
+ It does some pre-parsing, inter alia
+ -> assigning field identifiers from the file to real field names
+ -> split field values
+ -> filter out unwanted/useless fields
+
+ The return value is a description_data dict or None if the read data
+ are "useless" (not suited to create an ebuild for it,
+ e.g. if OS_TYPE is not unix).
+ """
+
+ raw_data = self._get_raw_data()
+ read_data = self._make_read_data ( raw_data )
+
+ self.desc_data = None
+
+ if read_data is None:
+ self.logger.warning (
+ "Failed to read file '%s'." % self.fileinfo ['package_file']
+ )
+
+ elif self._verify_read_data ( read_data ):
self.logger.debug (
"Successfully read file '%s' with data = %s."
% ( self.fileinfo ['package_file'], read_data )
)
self.desc_data = read_data
- # get_desc() is preferred, but this method returns the desc data, too
- return self.desc_data
+ # else have log entries from _verify()
# --- end of run (...) ---
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-06-29 22:48 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-06-29 22:48 UTC (permalink / raw
To: gentoo-commits
commit: 7c711ba2f85f5a3b4b5479dde81bb6b70a227a49
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jun 29 22:27:10 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jun 29 22:27:10 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7c711ba2
descriptionreader: join lines with '', not ' '
lines are now joined using an empty char, this fixes
reading entries like <<
a (>= 1.0), b
(> 1.5)
>>
fields whose values should be joined using ' ' have to
declare this in the field definition file using the 'joinValues' flag.
modified: roverlay/rpackage/descriptionreader.py
---
roverlay/rpackage/descriptionreader.py | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 1f6bd3e..94f36a3 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -108,21 +108,23 @@ class DescriptionReader ( object ):
make_slist = lambda l : tuple ( filter ( None, slist_split ( l, 0 ) ) )
for field in raw.keys():
- value_line = ' '.join ( filter ( None, raw [field] ) )
- # join > isList > wsList [... >= join (implicit)]
+ # join (' ') > isList > wsList [... >= join ('', implicit)]
if field in fields_join:
- read [field] = value_line
+ read [field] = ' '.join ( filter ( None, raw [field] ) )
- elif field in fields_isList:
- read [field] = make_list ( value_line )
+ else:
+ value_line = ''.join ( filter ( None, raw [field] ) )
- elif field in fields_wsList:
- read [field] = make_slist ( value_line )
+ if field in fields_isList:
+ read [field] = make_list ( value_line )
- else:
- read [field] = value_line
+ elif field in fields_wsList:
+ read [field] = make_slist ( value_line )
+
+ else:
+ read [field] = value_line
return read
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-07-02 16:52 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-07-02 16:52 UTC (permalink / raw
To: gentoo-commits
commit: 39ec3079553c96ff8f1d0522b47d8f6f09fa6d7c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 2 16:42:49 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 2 16:42:49 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=39ec3079
DescriptionReader: decode non-str lines
modified: roverlay/rpackage/descriptionreader.py
---
roverlay/rpackage/descriptionreader.py | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 94f36a3..1b3f62f 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -215,22 +215,23 @@ class DescriptionReader ( object ):
else:
fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
- # have to decode the lines
- read = lambda lines : [ line.decode().rstrip() for line in lines ]
else:
# open file handle only
fh = open ( filepath, 'r' )
- read = lambda lines : [ line.rstrip() for line in lines ]
- x = None
- read_lines = read ( fh.readlines() )
- del x, read
+
+ # decode lines of they're only bytes, using isinstance ( <>, str )
+ # 'cause isinstance ( <str>, bytes ) returns True
+ read_lines = tuple (
+ ( line if isinstance ( line, str ) else line.decode() ).rstrip()
+ for line in fh.readlines()
+ )
fh.close()
if not th is None: th.close()
del fh, th
- if hasattr ( self, 'write_desc_file' ):
+ if read_lines and hasattr ( self, 'write_desc_file' ):
try:
util.dodir ( DescriptionReader.WRITE_DESCFILES_DIR )
fh = open ( self.write_desc_file, 'w' )
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-07-03 17:48 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-07-03 17:48 UTC (permalink / raw
To: gentoo-commits
commit: ce26893a07ba30c0adaf34dd20b17222589e2be5
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 3 17:41:43 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 3 17:41:43 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ce26893a
DescriptionReader logging
optionally disable logging for ignored fields
modified: roverlay/rpackage/descriptionreader.py
---
roverlay/rpackage/descriptionreader.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 1b3f62f..4136e2c 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -10,6 +10,8 @@ import time
from roverlay import config, util
from roverlay.rpackage import descriptionfields
+LOG_IGNORED_FIELDS = True
+
def make_desc_packageinfo ( filepath ):
"""Creates a minimal dict that can be used as package info in the
DescriptionReader (for testing/debugging).
@@ -309,7 +311,10 @@ class DescriptionReader ( object ):
)
elif field_context_ref.has_flag ( 'ignore' ):
# field ignored
- self.logger.debug ( "Ignored field '%s'.", field_context )
+ if LOG_IGNORED_FIELDS:
+ self.logger.debug (
+ "Ignored field '%s'.", field_context_ref.get_name()
+ )
else:
field_context = field_context_ref.get_name()
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-07-06 22:19 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-07-06 22:19 UTC (permalink / raw
To: gentoo-commits
commit: e62fd4e641081815efc596bc1d719596eede6f6b
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 6 22:07:33 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 6 22:07:33 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e62fd4e6
DescriptionReader: no exception on field redef
The DescriptionReader now prints a warning if a field ('Title',..)
is specified more than once in a DESCRIPTION file.
Old behavior was to raise an exception.
modified: roverlay/rpackage/descriptionreader.py
---
roverlay/rpackage/descriptionreader.py | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index fca19e9..bfb50bb 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -293,7 +293,7 @@ class DescriptionReader ( object ):
pass
else:
- # line introduces a new field context, forget last one
+ # line has to introduce a new field context, forget last one
field_context = None
line_components = sline.partition (
@@ -301,13 +301,13 @@ class DescriptionReader ( object ):
)
if line_components [1]:
- # line contains a field separator, set field context
+ # line contains a field separator => new context, set it
field_context_ref = self.field_definition.get (
line_components [0]
)
if field_context_ref is None:
- # useless line, skip
+ # field not defined, skip
self.logger.info (
"Skipped a description field: '%s'.", line_components [0]
)
@@ -328,12 +328,20 @@ class DescriptionReader ( object ):
)
if field_context in raw:
- raise Exception ( "field %s exists!" % field_context )
+ # some packages have multiple Title fields
+ # warn about that 'cause it could lead to confusing
+ # ebuild/metadata output
+ self.logger.warning (
+ "field {} redefined!".format ( field_context )
+ )
+
+ raw [field_context].append ( sline )
- # add values to read_data, no need to check
- # line_components [2] 'cause [1] was a true str
- # create a new empty list for this field_context
- raw[field_context] = [ line_components [2].lstrip() ]
+ else:
+ # add values to read_data, no need to check
+ # line_components [2] 'cause [1] was a true str
+ # create a new empty list for this field_context
+ raw[field_context] = [ line_components [2].lstrip() ]
else:
# reaching this branch means that
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-07-30 8:52 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-07-30 8:52 UTC (permalink / raw
To: gentoo-commits
commit: 4a1edc718a09b2ce5499753c7d3bbb47d837b1ed
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 25 15:48:41 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 25 15:48:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=4a1edc71
workaround for Z compressed files
---
roverlay/rpackage/descriptionreader.py | 48 +++++++++++++++++++++----------
1 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index bfb50bb..52e9d2e 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -208,17 +208,16 @@ class DescriptionReader ( object ):
if tarfile.is_tarfile ( filepath ):
# filepath is a tarball, open tar handle + file handle
- th = tarfile.open ( filepath, 'r' )
+ th = tarfile.open ( filepath, mode='r' )
if pkg_name:
- fh = th.extractfile ( os.path.join (
- pkg_name,
- config.get ( 'DESCRIPTION.file_name' )
- ) )
+ fh = th.extractfile (
+ pkg_name + os.path.sep + config.get ( 'DESCRIPTION.file_name' )
+ )
else:
fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
else:
- # open file handle only
+ # open file handle only (!! .Z compressed tar files, FIXME)
fh = open ( filepath, 'r' )
@@ -270,6 +269,8 @@ class DescriptionReader ( object ):
comment_chars = config.get ( 'DESCRIPTION.comment_chars', '#' )
+ non_ascii_warned = False
+
for line in desc_lines:
field_context_ref = None
@@ -347,11 +348,25 @@ class DescriptionReader ( object ):
# reaching this branch means that
# (a) line has no leading whitespace
# (b) line has no separator (:)
- # this should not occur in description files (bad syntax?)
- self.logger.warning (
- "Unexpected line in description file: '%s'."
- % line_components [0]
- )
+ # this should not occur in description files (bad syntax,
+ # unknown compression (.Z!))
+
+ # !!! FIXME: handle .Z files properly or at least
+ # deny to read them
+ # remove non ascii-chars (could confuse the terminal)
+ ascii_str = util.ascii_filter ( line_components [0] )
+ if len ( ascii_str ) == len ( line_components [0] ):
+ self.logger.warning (
+ "Unexpected line in description file: {!r}.".format (
+ line_components [0]
+ ) )
+ elif not non_ascii_warned:
+ # probably compressed text
+ self.logger.warning (
+ 'Unexpected non-ascii line in description '
+ 'file (compressed text?)!'
+ )
+ non_ascii_warned = True
# -- end for --
@@ -383,14 +398,15 @@ class DescriptionReader ( object ):
if read_data is None:
self.logger.warning (
- "Failed to read file '%s'." % self.fileinfo ['package_file']
- )
+ "Failed to read file {f!r}.".format (
+ f=self.fileinfo ['package_file']
+ ) )
elif self._verify_read_data ( read_data ):
self.logger.debug (
- "Successfully read file '%s' with data = %s."
- % ( self.fileinfo ['package_file'], read_data )
- )
+ "Successfully read file {f} with data = {d}.".format (
+ f=self.fileinfo ['package_file'], d=read_data
+ ) )
self.desc_data = read_data
# else have log entries from _verify()
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2012-08-07 8:50 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2012-08-07 8:50 UTC (permalink / raw
To: gentoo-commits
commit: 9692add5a980cd10bd8e4841c9b8e55aa46a8d91
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug 7 08:49:19 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug 7 08:49:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9692add5
descriptionreader: use bytes_try_decode() from strutil
---
roverlay/rpackage/descriptionreader.py | 61 +++++++++++++++++--------------
1 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index a5e645e..354ac94 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -9,6 +9,7 @@
__all__ = [ 'DescriptionReader', 'make_desc_packageinfo', ]
import re
+import sys
import tarfile
import os.path
import time
@@ -207,38 +208,42 @@ class DescriptionReader ( object ):
"Starting to read file {f!r} ...\n".format ( f=filepath )
)
- if not ( isinstance ( filepath, str ) and filepath ):
- raise Exception ( "bad usage" )
-
- # read describes how to import the lines from a file (e.g. rstrip())
- # fh, th are file/tar handles
- read = th = fh = None
+ try:
+ # read describes how to import the lines from a file (e.g. rstrip())
+ # fh, th are file/tar handles
+ read = th = fh = None
+
+ if tarfile.is_tarfile ( filepath ):
+ # filepath is a tarball, open tar handle + file handle
+ th = tarfile.open ( filepath, mode='r' )
+ if pkg_name:
+ fh = th.extractfile (
+ pkg_name + os.path.sep + \
+ config.get ( 'DESCRIPTION.file_name' )
+ )
+ else:
+ fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
- if tarfile.is_tarfile ( filepath ):
- # filepath is a tarball, open tar handle + file handle
- th = tarfile.open ( filepath, mode='r' )
- if pkg_name:
- fh = th.extractfile (
- pkg_name + os.path.sep + config.get ( 'DESCRIPTION.file_name' )
+ else:
+ # open file handle only
+ # COULDFIX: .Z compressed tar files could be opened here
+ fh = open ( filepath, 'r' )
+
+ if sys.version_info >= ( 3, ):
+ # decode lines of they're only bytes, using isinstance ( <>, str )
+ # 'cause isinstance ( <str>, bytes ) returns True
+ # FIXME: encoding is unknown, could be ascii/iso8859*/utf8
+ read_lines = tuple (
+ strutil.bytes_try_decode ( l ).rstrip() for l in fh.readlines()
)
else:
- fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
-
- else:
- # open file handle only
- # COULDFIX: .Z compressed tar files could be opened here
- fh = open ( filepath, 'r' )
-
- # decode lines of they're only bytes, using isinstance ( <>, str )
- # 'cause isinstance ( <str>, bytes ) returns True
- read_lines = tuple (
- ( line if isinstance ( line, str ) else line.decode() ).rstrip()
- for line in fh.readlines()
- )
+ # python2 shouldn't need special decoding
+ read_lines = tuple ( l.rstrip() for l in fh.readlines() )
- fh.close()
- if not th is None: th.close()
- del fh, th
+ finally:
+ if 'fh' in locals() and fh: fh.close()
+ if 'th' in locals() and th: th.close()
+ del fh, th
if read_lines and hasattr ( self, 'write_desc_file' ):
try:
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-02-09 20:45 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-02-09 20:45 UTC (permalink / raw
To: gentoo-commits
commit: 013b826ab3d76679c15bad875eb90120e0cfada0
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb 9 19:33:28 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb 9 20:08:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=013b826a
rpackage/descriptionreader: remove FIXME comment
this has already been fixed by using strutil.bytes_try_decode().
---
roverlay/rpackage/descriptionreader.py | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 354ac94..567fa1e 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -230,9 +230,8 @@ class DescriptionReader ( object ):
fh = open ( filepath, 'r' )
if sys.version_info >= ( 3, ):
- # decode lines of they're only bytes, using isinstance ( <>, str )
- # 'cause isinstance ( <str>, bytes ) returns True
- # FIXME: encoding is unknown, could be ascii/iso8859*/utf8
+ # decode lines,
+ # encoding is unknown, could be ascii/iso8859*/utf8/<other>
read_lines = tuple (
strutil.bytes_try_decode ( l ).rstrip() for l in fh.readlines()
)
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-04-25 16:44 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-04-25 16:44 UTC (permalink / raw
To: gentoo-commits
commit: 920071a4b355cc4c58d76dd8b0d00554decc84f2
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Apr 25 14:53:37 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Apr 25 14:53:37 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=920071a4
descriptionreader: dont append empty lines
DescriptionReader will no longer add empty (whitespace-only) lines
to data fields like Depends, ...
---
roverlay/rpackage/descriptionreader.py | 41 +++++++++++++++++++++++--------
1 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 567fa1e..029244e 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -232,12 +232,12 @@ class DescriptionReader ( object ):
if sys.version_info >= ( 3, ):
# decode lines,
# encoding is unknown, could be ascii/iso8859*/utf8/<other>
- read_lines = tuple (
+ read_lines = [
strutil.bytes_try_decode ( l ).rstrip() for l in fh.readlines()
- )
+ ]
else:
# python2 shouldn't need special decoding
- read_lines = tuple ( l.rstrip() for l in fh.readlines() )
+ read_lines = [ l.rstrip() for l in fh.readlines() ]
finally:
if 'fh' in locals() and fh: fh.close()
@@ -342,21 +342,31 @@ class DescriptionReader ( object ):
'already been catched in DescriptionField...'
)
- if field_context in raw:
+ new_value = line_components [2].strip()
+ field_value = raw.get ( field_context, None )
+
+ if not new_value:
+ # add nothing but create field if it does not exist
+ if field_value is None:
+ raw [field_context] = []
+
+ elif field_value is None:
+ # create a new empty list for this field_context
+ # and add values to read_data
+ raw [field_context] = [ new_value ]
+
+ elif field_value:
# some packages have multiple Title fields
# warn about that 'cause it could lead to confusing
# ebuild/metadata output
self.logger.warning (
- "field {f} redefined!".format ( f=field_context )
+ "field redefinition: {f!r}".format ( f=field_context )
)
- raw [field_context].append ( sline )
+ field_value.append ( new_value )
else:
- # add values to read_data, no need to check
- # line_components [2] 'cause [1] was a true str
- # create a new empty list for this field_context
- raw[field_context] = [ line_components [2].lstrip() ]
+ field_value.append ( new_value )
else:
# reaching this branch means that
@@ -383,7 +393,16 @@ class DescriptionReader ( object ):
# -- end for --
- return raw
+ if raw:
+ return raw
+ elif non_ascii_warned:
+ return None
+ else:
+ # empty desc_data!
+ return raw
+
+ # Alternatively, always return None if raw is empty
+ #return raw or None
# --- end of _get_raw_data (...) ---
def run ( self ):
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-07-11 16:29 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-11 16:29 UTC (permalink / raw
To: gentoo-commits
commit: e78227e1e9a506e9748c58eec48980aadf800bc0
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 16:24:46 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 16:24:46 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e78227e1
roverlay/rpackage/licensemap: remove debug code
---
roverlay/rpackage/licensemap.py | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/roverlay/rpackage/licensemap.py b/roverlay/rpackage/licensemap.py
index ae6cffd..2332ee6 100644
--- a/roverlay/rpackage/licensemap.py
+++ b/roverlay/rpackage/licensemap.py
@@ -20,17 +20,6 @@ RE_WORD_WIPE = re.compile (
')'
)
-MISSING = set()
-ADD_MISS = MISSING.add
-
-def write_miss():
- with open ( '/tmp/lmiss', 'wt' ) as FH:
- for word in MISSING:
- FH.write ( word )
- FH.write ( '\n' )
-
-import atexit
-atexit.register ( write_miss )
def reduce_key ( key ):
return RE_WORD_WIPE.sub ( '', RE_WIPE.sub ( '', key ) )
@@ -86,7 +75,6 @@ class LicenseMap ( object ):
# no license_map_file
pass
- ADD_MISS ( k )
self.logger.warning (
"Missing license map entry for {!r} ({!r})".format ( k, key )
)
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
2013-07-23 18:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-07-23 18:34 ` André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-23 18:34 UTC (permalink / raw
To: gentoo-commits
commit: 7481d8294f8ba8e6045ae84ba524b80997b72f60
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 23 18:32:08 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 23 18:32:08 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7481d829
do not fail if license map file is missing
---
roverlay/rpackage/licensemap.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/roverlay/rpackage/licensemap.py b/roverlay/rpackage/licensemap.py
index 2332ee6..f64664d 100644
--- a/roverlay/rpackage/licensemap.py
+++ b/roverlay/rpackage/licensemap.py
@@ -67,13 +67,12 @@ class LicenseMap ( object ):
except KeyError:
pass
- try:
- return self.license_map_file [k]
- except KeyError:
- pass
- except AttributeError:
- # no license_map_file
- pass
+ if self.license_map_file:
+ # else no license_map_file
+ try:
+ return self.license_map_file [k]
+ except KeyError:
+ pass
self.logger.warning (
"Missing license map entry for {!r} ({!r})".format ( k, key )
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-07-25 8:47 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-25 8:47 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-07-25 8:47 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-25 8:47 UTC (permalink / raw
To: gentoo-commits
commit: 27d832cc8c15efc9d35dd6527cb16e6a52112792
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 25 08:46:19 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 25 08:46:19 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=27d832cc
roverlay/rpackage/descriptionfields: fix get()
---
roverlay/rpackage/descriptionfields.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/roverlay/rpackage/descriptionfields.py b/roverlay/rpackage/descriptionfields.py
index 58b83c5..b31c280 100644
--- a/roverlay/rpackage/descriptionfields.py
+++ b/roverlay/rpackage/descriptionfields.py
@@ -170,11 +170,12 @@ class DescriptionField ( object ):
# bad identifier
return False
- if 'withcase' in self.aliases:
- if field_identifier in self.aliases ['withcase']:
+ elif 'withcase' in self.aliases and (
+ field_identifier in self.aliases ['withcase']
+ ):
return True
- if 'nocase' in self.aliases:
+ elif 'nocase' in self.aliases:
field_id_lower = field_identifier.lower()
if field_id_lower in self.aliases ['nocase']:
return True
@@ -272,7 +273,16 @@ class DescriptionFields ( object ):
arguments:
* field_name --
"""
- return self.fields.get ( field_name, None )
+ field = self.fields.get ( field_name, None )
+ if field is None:
+ for field in self.fields.values():
+ if field.matches_alias ( field_name ):
+ return field
+ else:
+ return None
+ else:
+ return field
+
# --- end of get (...) ---
def find_field ( self, field_name ):
@@ -282,14 +292,13 @@ class DescriptionFields ( object ):
arguments:
* field_name --
"""
-
field = self.get ( field_name )
if field is None:
- for field in self.fields:
+ for field in self.fields.values():
if field.matches_alias ( field_name ):
- return field.get_name ()
+ return field.get_name()
else:
- return field.get_name ()
+ return field.get_name()
# --- end of find_field (...) ---
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-07-25 13:25 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-25 13:25 UTC (permalink / raw
To: gentoo-commits
commit: 455dacba38d8c8ef5c462f0fe2a1a45c1078bcb1
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 25 13:21:39 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 25 13:21:39 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=455dacba
descriptionreader: join list items
This allows to combine the "joinValues" with "isList", ...
---
roverlay/rpackage/descriptionreader.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index b589489..824c345 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -145,8 +145,8 @@ class DescriptionReader ( object ):
for field_name, field_value in raw.items():
- # $hardcoded > join (' ') > isList
- # > wsList [... >= join ('', implicit)]
+ # final value: $hardcoded > join (' ', value_line) > value_line
+ # and for value_line: isList > wsList [... >= join ('', implicit)]
if field_name in fields_license:
license_str = license_map.lookup ( ' '.join ( field_value ) )
@@ -154,7 +154,16 @@ class DescriptionReader ( object ):
read [field_name] = license_str
elif field_name in fields_join:
- read [field_name] = ' '.join ( filter ( None, field_value ) )
+ if field_name in fields_isList:
+ read [field_name] = ' '.join (
+ ' '.join ( make_list ( l ) for l in field_value if l )
+ )
+ elif field_name in fields_wsList:
+ read [field_name] = ' '.join (
+ ' '.join ( make_slist ( l ) for l in field_value if l )
+ )
+ else:
+ read [field_name] = ' '.join ( filter ( None, field_value ) )
else:
value_line = ''.join ( filter ( None, field_value ) )
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-07-25 13:28 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-07-25 13:28 UTC (permalink / raw
To: gentoo-commits
commit: ea5c788f03ebe11fe482d88b8ef34fb6da53a2fc
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 25 13:27:56 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 25 13:27:56 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ea5c788f
fix 'descriptionreader: join list items'
---
roverlay/rpackage/descriptionreader.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 824c345..5eff4e0 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -156,11 +156,11 @@ class DescriptionReader ( object ):
elif field_name in fields_join:
if field_name in fields_isList:
read [field_name] = ' '.join (
- ' '.join ( make_list ( l ) for l in field_value if l )
+ ' '.join ( make_list ( l ) ) for l in field_value if l
)
elif field_name in fields_wsList:
read [field_name] = ' '.join (
- ' '.join ( make_slist ( l ) for l in field_value if l )
+ ' '.join ( make_slist ( l ) ) for l in field_value if l
)
else:
read [field_name] = ' '.join ( filter ( None, field_value ) )
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-08-20 21:46 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-08-20 21:46 UTC (permalink / raw
To: gentoo-commits
commit: d63e6cb99f34b6b5434b89812de3a14645bd1292
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug 20 16:34:22 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug 20 16:34:22 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d63e6cb9
R package description reader: fix race condition
This commit fixes a race condition concerning WRITE_DESCFILES_DIR. Setting it at
module import time doesn't work, because roverlay's config is not initialized,
so WRITE_DESCFILES_DIR was always None (=disabled).
DescriptionReader now initializes this variable when the first object is created
(calls setup actions in __new__()). This, however, means that an object has to
be created before the variable is accessible (!).
Additionally, some common (not object-specific) variables are now available
as class-wide variables (no longer bound to self or locals()).
---
roverlay/rpackage/descriptionreader.py | 152 +++++++++++++++++++++------------
1 file changed, 99 insertions(+), 53 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index 5eff4e0..d011e3f 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -8,6 +8,7 @@
__all__ = [ 'DescriptionReader', 'make_desc_packageinfo', ]
+import string
import re
import sys
import tarfile
@@ -20,6 +21,8 @@ from roverlay.rpackage import descriptionfields
LOG_IGNORED_FIELDS = True
+STR_FORMATTER = string.Formatter()
+
def make_desc_packageinfo ( filepath ):
"""Creates a minimal dict that can be used as package info in the
DescriptionReader (for testing/debugging).
@@ -39,34 +42,68 @@ def make_desc_packageinfo ( filepath ):
class DescriptionReader ( object ):
"""Description Reader"""
- WRITE_DESCFILES_DIR = config.get ( 'DESCRIPTION.descfiles_dir', None )
+ _NEEDS_SETUP = True
- def __init__ ( self,
- package_info, logger,
- read_now=False, write_desc=True
- ):
- """Initializes a DESCRIPTION file reader."""
+ DESCFILE_NAME = None
+ FIELD_SEPARATOR = None
+ FIELD_DEFINITION = None
+ WRITE_DESCFILES_DIR = None
+ RE_LIST_SPLIT = None
+ RE_SLIST_SPLIT = None
+
+ @classmethod
+ def _setup_cls ( cls ):
+ cls.DESCFILE_NAME = config.get_or_fail ( 'DESCRIPTION.file_name' )
+ cls.FIELD_SEPARATOR = config.get ( 'DESCRIPTION.field_separator', ':' )
- if not config.access().get_field_definition():
+ cls.FIELD_DEFINITION = config.access().get_field_definition()
+ if not cls.FIELD_DEFINITION:
raise Exception (
- "Field definition is missing, cannot initialize DescriptionReader."
+ 'Field definition is missing, '
+ 'cannot initialize DescriptionReader.'
)
- self.field_definition = config.access().get_field_definition()
- self.fileinfo = package_info
- self.logger = logger.getChild ( 'desc_reader' )
+ cls.WRITE_DESCFILES_DIR = config.get (
+ 'DESCRIPTION.descfiles_dir', False
+ )
- if write_desc and DescriptionReader.WRITE_DESCFILES_DIR is not None:
- self.write_desc_file = os.path.join (
- DescriptionReader.WRITE_DESCFILES_DIR,
- '{name}_{ver}.desc'.format (
- name=self.fileinfo ['name'], ver=self.fileinfo ['ebuild_verstr']
+ cls.RE_LIST_SPLIT = re.compile (
+ config.get_or_fail ( 'DESCRIPTION.list_split_regex' )
+ )
+ cls.RE_SLIST_SPLIT = re.compile ( '\s+' )
+ # --- end of _setup_cls (...) ---
+
+ def __new__ ( cls, *args, **kwargs ):
+ if cls._NEEDS_SETUP:
+ cls._setup_cls()
+ cls._NEEDS_SETUP = False
+
+ return super ( DescriptionReader, cls ).__new__ ( cls, *args, **kwargs )
+ # --- end of __new__ (...) ---
+
+ def get_descfile_dest ( self ):
+ descfiles_dir = self.WRITE_DESCFILES_DIR
+ if descfiles_dir:
+ return (
+ descfiles_dir + os.sep + STR_FORMATTER.vformat (
+ '{name}_{ebuild_verstr}.desc', (), self.fileinfo
)
)
+ else:
+ return None
+ # --- end of get_descfile_dest (...) ---
+
+ def __init__ ( self,
+ package_info, logger,
+ read_now=False, write_desc=True
+ ):
+ """Initializes a DESCRIPTION file reader."""
+ self.fileinfo = package_info
+ self.logger = logger.getChild ( 'desc_reader' )
+ self.write_desc_file = self.get_descfile_dest() if write_desc else None
if read_now:
self.run()
-
# --- end of __init__ (...) ---
def parse_file ( self, filepath ):
@@ -116,10 +153,10 @@ class DescriptionReader ( object ):
# this dict will be returned as result later
read = dict()
- flags = self.field_definition.get_fields_with_flag
+ flags = self.FIELD_DEFINITION.get_fields_with_flag
# insert default values
- default_values = self.field_definition.get_fields_with_default_value()
+ default_values = self.FIELD_DEFINITION.get_fields_with_default_value()
for field_name in default_values.keys():
if not field_name in raw:
@@ -133,15 +170,12 @@ class DescriptionReader ( object ):
fields_license = flags ( 'isLicense' )
if fields_license:
- license_map = self.field_definition.license_map
-
- list_split = re.compile (
- config.get_or_fail ( 'DESCRIPTION.list_split_regex' )
- ).split
- slist_split = re.compile ( '\s+' ).split
+ license_map = self.FIELD_DEFINITION.license_map
- make_list = lambda l : tuple ( filter ( None, list_split ( l, 0 ) ) )
- make_slist = lambda l : tuple ( filter ( None, slist_split ( l, 0 ) ) )
+ list_split = self.RE_LIST_SPLIT.split
+ slist_split = self.RE_SLIST_SPLIT.split
+ make_list = lambda l : list ( filter ( None, list_split ( l, 0 ) ) )
+ make_slist = lambda l : list ( filter ( None, slist_split ( l, 0 ) ) )
for field_name, field_value in raw.items():
@@ -155,6 +189,7 @@ class DescriptionReader ( object ):
elif field_name in fields_join:
if field_name in fields_isList:
+ # FIXME: "... if l" -- "make_list() := list(filter(None,...))"
read [field_name] = ' '.join (
' '.join ( make_list ( l ) ) for l in field_value if l
)
@@ -188,7 +223,7 @@ class DescriptionReader ( object ):
Returns True (^= valid data) or False (^= cannot use package)
"""
- fref = self.field_definition
+ fref = self.FIELD_DEFINITION
# ensure that all mandatory fields are set
missing_fields = set ()
@@ -250,21 +285,23 @@ class DescriptionReader ( object ):
"Starting to read file {f!r} ...".format ( f=filepath )
)
+ th = None
+ fh = None
+
try:
# read describes how to import the lines from a file (e.g. rstrip())
# fh, th are file/tar handles
- read = th = fh = None
+ read = None
if tarfile.is_tarfile ( filepath ):
# filepath is a tarball, open tar handle + file handle
th = tarfile.open ( filepath, mode='r' )
if pkg_name:
fh = th.extractfile (
- pkg_name + os.path.sep + \
- config.get ( 'DESCRIPTION.file_name' )
+ pkg_name + os.path.sep + self.DESCFILE_NAME
)
else:
- fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) )
+ fh = th.extractfile ( self.DESCFILE_NAME )
else:
# open file handle only
@@ -282,11 +319,12 @@ class DescriptionReader ( object ):
read_lines = [ l.rstrip() for l in fh.readlines() ]
finally:
- if 'fh' in locals() and fh: fh.close()
- if 'th' in locals() and th: th.close()
+ if fh: fh.close()
+ if th: th.close()
del fh, th
- if read_lines and hasattr ( self, 'write_desc_file' ):
+ if read_lines and self.write_desc_file is not None:
+ fh = None
try:
util.dodir ( DescriptionReader.WRITE_DESCFILES_DIR )
fh = open ( self.write_desc_file, 'w' )
@@ -297,8 +335,8 @@ class DescriptionReader ( object ):
fh.write ( '\n'.join ( read_lines ) )
fh.write ( '\n' )
finally:
- if 'fh' in locals() and fh: fh.close()
-
+ if fh:
+ fh.close()
return read_lines
@@ -339,22 +377,22 @@ class DescriptionReader ( object ):
# line has to introduce a new field context, forget last one
field_context = None
- line_components = sline.partition (
- config.get ( 'DESCRIPTION.field_separator', ':' )
- )
+ line_components = sline.partition ( self.FIELD_SEPARATOR )
if line_components [1]:
# line contains a field separator => new context, set it
- field_context_ref = self.field_definition.get (
+ field_context_ref = self.FIELD_DEFINITION.get (
line_components [0]
)
if field_context_ref is None:
# field not defined, skip
self.logger.info (
- "Skipped a description field: {f!r}.".format (
- f=line_components [0]
- ) )
+ STR_FORMATTER.vformat (
+ "Skipped a description field: {0!r}.",
+ line_components, {}
+ )
+ )
elif field_context_ref.has_flag ( 'ignore' ):
# field ignored
if LOG_IGNORED_FIELDS:
@@ -410,9 +448,11 @@ class DescriptionReader ( object ):
ascii_str = strutil.ascii_filter ( line_components [0] )
if len ( ascii_str ) == len ( line_components [0] ):
self.logger.warning (
- "Unexpected line in description file: {!r}.".format (
- line_components [0]
- ) )
+ STR_FORMATTER.vformat (
+ "Unexpected line in description file: {0!r}.",
+ line_components, {}
+ )
+ )
elif not non_ascii_warned:
# probably compressed text
self.logger.warning (
@@ -473,21 +513,27 @@ class DescriptionReader ( object ):
if read_data is None:
self.logger.warning (
- "Failed to read file {f!r}.".format (
- f=self.fileinfo ['package_file']
- ) )
+ STR_FORMATTER.vformat (
+ "Failed to read file {package_file!r}.", (), self.fileinfo
+ )
+ )
elif self._verify_read_data ( read_data ):
self.logger.debug (
- "Successfully read file {f} with data = {d}.".format (
- f=self.fileinfo ['package_file'], d=read_data
- ) )
+ STR_FORMATTER.vformat (
+ "Successfully read file {package_file!r} with data = {0}.",
+ ( read_data, ), self.fileinfo
+ )
+ )
self.desc_data = read_data
# else have log entries from _verify()
# --- end of run (...) ---
+# --- end of DescriptionReader ---
+
+
def read ( package_info, logger=None ):
return DescriptionReader (
package_info = package_info,
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-08-21 13:51 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-08-21 13:51 UTC (permalink / raw
To: gentoo-commits
commit: 72e6ddeeeaa4ffb1dbe6da9d7eee6cbef12f0770
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 21 13:48:22 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 21 13:48:22 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=72e6ddee
rpackage/descriptionfields, configure(): reset var
Reset self.early_value_validation when running configure().
---
roverlay/rpackage/descriptionfields.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/roverlay/rpackage/descriptionfields.py b/roverlay/rpackage/descriptionfields.py
index b31c280..17503ff 100644
--- a/roverlay/rpackage/descriptionfields.py
+++ b/roverlay/rpackage/descriptionfields.py
@@ -31,7 +31,6 @@ class DescriptionField ( object ):
self.flags = list()
self.allowed_values = list()
self.aliases = dict()
-
# --- end of __init__ (...) ---
def get_name ( self ):
@@ -210,16 +209,18 @@ class DescriptionField ( object ):
# --- end of value_allowed (...) ---
def configure ( self ):
- self.allowed_values = frozenset ( self.allowed_values )
- self.flags = frozenset ( self.flags )
+ self.allowed_values = frozenset ( self.allowed_values )
+ self.flags = frozenset ( self.flags )
- if self.has_flag ( 'isLicense' ):
+ if 'islicense' in self.flags:
self.early_value_validation = True
- elif self.allowed_values:
- self.allowed_values_nocase = frozenset (
- s.lower() for s in self.allowed_values
- )
- # --- end of update (...) ---
+ else:
+ self.early_value_validation = False
+ if self.allowed_values:
+ self.allowed_values_nocase = frozenset (
+ s.lower() for s in self.allowed_values
+ )
+ # --- end of configure (...) ---
# --- end of DescriptionField ---
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2013-08-21 13:51 André Erdmann
0 siblings, 0 replies; 21+ messages in thread
From: André Erdmann @ 2013-08-21 13:51 UTC (permalink / raw
To: gentoo-commits
commit: 8a8e58c408b01ace3e9accb409e7e00f5af2aad8
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 21 13:49:20 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 21 13:49:20 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8a8e58c4
rpackage/descriptionreader: join aliased fields (fix)
* properly join aliased is*List fields (e.g. "Recommends","Suggests" ->
"Suggests").
* set pkg_name in parse_file()
---
roverlay/rpackage/descriptionreader.py | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index d011e3f..f0189a1 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -8,6 +8,7 @@
__all__ = [ 'DescriptionReader', 'make_desc_packageinfo', ]
+import os.path
import string
import re
import sys
@@ -107,7 +108,8 @@ class DescriptionReader ( object ):
# --- end of __init__ (...) ---
def parse_file ( self, filepath ):
- desc_lines = self._get_desc_from_file ( filepath )
+ pkg_name = os.path.basename ( filepath ).partition ( '_' )[0]
+ desc_lines = self._get_desc_from_file ( filepath, pkg_name=pkg_name )
if desc_lines is None:
return None
else:
@@ -403,15 +405,8 @@ class DescriptionReader ( object ):
else:
field_context = field_context_ref.get_name()
-
- if not field_context:
- raise Exception (
- 'Field name is not valid! This should\'ve '
- 'already been catched in DescriptionField...'
- )
-
- new_value = line_components [2].strip()
- field_value = raw.get ( field_context, None )
+ new_value = line_components [2].strip()
+ field_value = raw.get ( field_context, None )
if not new_value:
# add nothing but create field if it does not exist
@@ -424,13 +419,13 @@ class DescriptionReader ( object ):
raw [field_context] = [ new_value ]
elif field_value:
- # some packages have multiple Title fields
- # warn about that 'cause it could lead to confusing
- # ebuild/metadata output
- self.logger.warning (
- "field redefinition: {f!r}".format ( f=field_context )
- )
+ # aliased field (e.g. "Recommends","Suggests"->"Suggests")
+ # or redefinition (not checked here)
+ if 'islist' in field_context_ref.flags:
+ field_value.append ( "," )
+ elif 'iswhitespacelist' in field_context_ref.flags:
+ field_value.append ( " " )
field_value.append ( new_value )
else:
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
@ 2014-02-16 1:35 Benda XU
0 siblings, 0 replies; 21+ messages in thread
From: Benda XU @ 2014-02-16 1:35 UTC (permalink / raw
To: gentoo-commits
commit: d18a5308600c3d6432644a97a8a830bb188e66ca
Author: Benda Xu <heroxbd <AT> gmail <DOT> com>
AuthorDate: Sun Feb 16 01:33:35 2014 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Feb 16 01:34:39 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d18a5308
roverlay/rpackage/descriptionreader.py: object() does not take an argument
The parent of DescriptionReader is object, which is created with object.__new__(cls).
---
roverlay/rpackage/descriptionreader.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index f0189a1..d5db52b 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -79,7 +79,7 @@ class DescriptionReader ( object ):
cls._setup_cls()
cls._NEEDS_SETUP = False
- return super ( DescriptionReader, cls ).__new__ ( cls, *args, **kwargs )
+ return super ( DescriptionReader, cls ).__new__ ( cls )
# --- end of __new__ (...) ---
def get_descfile_dest ( self ):
^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2014-02-16 1:35 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-25 16:44 [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/ André Erdmann
-- strict thread matches above, loose matches on Subject: below --
2014-02-16 1:35 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-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-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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox