Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ebuild/
Date: Fri, 06 Jul 2012 22:19:32
Message-Id: 1341612339.6ff7308157e9ec2cc9a189ba4ad9a625328752bc.dywi@gentoo
1 commit: 6ff7308157e9ec2cc9a189ba4ad9a625328752bc
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Fri Jul 6 22:05:39 2012 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Fri Jul 6 22:05:39 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6ff73081
7
8 fix and extend invalid char in ebuilds
9
10 modified: roverlay/ebuild/abstractcomponents.py
11
12 ---
13 roverlay/ebuild/abstractcomponents.py | 18 +++++++++++++++---
14 1 files changed, 15 insertions(+), 3 deletions(-)
15
16 diff --git a/roverlay/ebuild/abstractcomponents.py b/roverlay/ebuild/abstractcomponents.py
17 index f943948..6fbc959 100644
18 --- a/roverlay/ebuild/abstractcomponents.py
19 +++ b/roverlay/ebuild/abstractcomponents.py
20 @@ -1,7 +1,10 @@
21 # R Overlay -- ebuild creation, <?>
22 +# -*- coding: utf-8 -*-
23 # Copyright 2006-2012 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25
26 +import re
27 +
28 INDENT = '\t'
29
30 def listlike ( ref ):
31 @@ -112,7 +115,7 @@ class ListValue ( object ):
32 class EbuildVar ( object ):
33 """An ebuild variable."""
34
35 - QUOTE_CHARS = "\"\'"
36 + IGNORED_VALUE_CHARS = re.compile ( "[\"'`¸]" )
37
38 def __init__ ( self, name, value, priority, param_expansion=True ):
39 """Initializes an EbuildVar.
40 @@ -129,6 +132,7 @@ class EbuildVar ( object ):
41 self.set_level ( 0 )
42 self.use_param_expansion = param_expansion
43 self.print_empty_var = False
44 + # --- end of __init__ (...) ---
45
46 def set_level ( self, level ):
47 """Sets the indention level."""
48 @@ -150,17 +154,24 @@ class EbuildVar ( object ):
49 return len ( self.value ) > 0
50 else:
51 return True
52 + # --- end of active (...) ---
53
54 def _quote_value ( self ):
55 - q = '"' if self.use_param_expansion else "'"
56 + q = '"' if self.use_param_expansion else '"'
57 +
58 if hasattr ( self, '_get_value_str' ):
59 vstr = self._get_value_str()
60 else:
61 vstr = str ( self.value )
62 +
63 # removing all quote chars from values,
64 # the "constructed" {R,}DEPEND/R_SUGGESTS/IUSE vars don't use them
65 # and DESCRIPTION/SRC_URI don't need them
66 - return q + vstr.strip ( EbuildVar.QUOTE_CHARS ) + q
67 + if len ( vstr ) == 0:
68 + return 2 * q
69 + else:
70 + return q + EbuildVar.IGNORED_VALUE_CHARS.sub ( '', vstr ) + q
71 + # --- end of _quote_value (...) ---
72
73 def __str__ ( self ):
74 valstr = self._quote_value()
75 @@ -172,3 +183,4 @@ class EbuildVar ( object ):
76 # this filters out the result of strip(QUOTE_CHARS) for values that
77 # contain only quote chars
78 return ""
79 + # --- end of __str__ (...) ---