diff options
author | Jauhien Piatlicki (jauhien) <piatlicki@gmail.com> | 2013-09-05 13:54:12 +0200 |
---|---|---|
committer | Jauhien Piatlicki (jauhien) <piatlicki@gmail.com> | 2013-09-05 13:54:12 +0200 |
commit | 71062a6167f767e15a22ac10edd996b3cad667a3 (patch) | |
tree | 75d5c6b656c122eb721061c1a099b116fbc0f771 /g_sorcery | |
parent | g_sorcery/package_db: use a single file for a category (diff) | |
download | g-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.tar.gz g-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.tar.bz2 g-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.zip |
variables without quotation in ebuild-generator
Diffstat (limited to 'g_sorcery')
-rw-r--r-- | g_sorcery/ebuild.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/g_sorcery/ebuild.py b/g_sorcery/ebuild.py index 36847f9..4c2e318 100644 --- a/g_sorcery/ebuild.py +++ b/g_sorcery/ebuild.py @@ -168,7 +168,10 @@ class DefaultEbuildGenerator(EbuildGenerator): inherit entry is just a list of eclass names. vars* entries are lists of variables in tw0 possible formats: 1. A string with variable name - 2. A tuple (varname, value) + 2. A dictinary with entries: + name: variable name + value: variable value + raw: if present, not quotation of value will be done Variable names are automatically transformed to the upper-case. """ def __init__(self, package_db, layout): @@ -218,15 +221,19 @@ class DefaultEbuildGenerator(EbuildGenerator): Args: variables: List of variables. """ - VAR_NAME = 0 - VAR_VALUE = 1 - for var in variables: if isinstance(var, basestring): self.template.append(var.upper() + '="%(' + var + ')s"') else: - self.template.append(var[VAR_NAME].upper() \ - + '="' + var[VAR_VALUE] + '"') + if "raw" in var: + quote = '' + else: + quote = '"' + if "value" in var: + self.template.append(var["name"].upper() \ + + '=' + quote + var["value"] + quote) + else: + self.template.append(var["name"].upper() + '=' + quote + '%(' + var["name"] + ')s' + quote) def get_template(self, package, ebuild_data): |