aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-05 13:54:12 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-05 13:54:12 +0200
commit71062a6167f767e15a22ac10edd996b3cad667a3 (patch)
tree75d5c6b656c122eb721061c1a099b116fbc0f771
parentg_sorcery/package_db: use a single file for a category (diff)
downloadg-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.tar.gz
g-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.tar.bz2
g-sorcery-71062a6167f767e15a22ac10edd996b3cad667a3.zip
variables without quotation in ebuild-generator
-rw-r--r--g_sorcery/ebuild.py19
-rw-r--r--gs_ctan/ebuild.py6
-rw-r--r--gs_elpa/ebuild.py4
-rw-r--r--gs_pypi/ebuild.py8
4 files changed, 22 insertions, 15 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):
diff --git a/gs_ctan/ebuild.py b/gs_ctan/ebuild.py
index d8b4f65..0dbb5a0 100644
--- a/gs_ctan/ebuild.py
+++ b/gs_ctan/ebuild.py
@@ -32,7 +32,7 @@ class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
inherit = ["gs-ctan"]
vars_after_description = \
- ["homepage", ("src_uri", ""), "license"]
+ ["homepage", {"name" : "src_uri", "value" : ""}, "license"]
vars_after_keywords = \
["depend", "rdepend"]
@@ -48,12 +48,12 @@ class CtanEbuildWithDigestGenerator(DefaultEbuildGenerator):
def __init__(self, package_db):
vars_before_inherit = \
- ["base_src_uri", "catalogue", "source_type", "realname", ("digest_sources", "yes")]
+ ["base_src_uri", "catalogue", "source_type", "realname", {"name" : "digest_sources", "value" : "yes"}]
inherit = ["gs-ctan"]
vars_after_description = \
- ["homepage", ("src_uri", "${BASE_SRC_URI}${CATALOGUE}${REALNAME}.${SOURCE_TYPE} -> ${P}.${SOURCE_TYPE}"), "license"]
+ ["homepage", {"name" : "src_uri", "value" : "${BASE_SRC_URI}${CATALOGUE}${REALNAME}.${SOURCE_TYPE} -> ${P}.${SOURCE_TYPE}"}, "license"]
vars_after_keywords = \
["depend", "rdepend"]
diff --git a/gs_elpa/ebuild.py b/gs_elpa/ebuild.py
index 460ccfa..d1d63f2 100644
--- a/gs_elpa/ebuild.py
+++ b/gs_elpa/ebuild.py
@@ -27,12 +27,12 @@ class ElpaEbuildWithDigestGenerator(DefaultEbuildGenerator):
def __init__(self, package_db):
vars_before_inherit = \
- ["repo_uri", "source_type", "realname", ("digest_sources", "yes")]
+ ["repo_uri", "source_type", "realname", {"name" : "digest_sources", "value" : "yes"}]
inherit = ["g-sorcery", "gs-elpa"]
vars_after_description = \
- ["homepage", ("src_uri", "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}")]
+ ["homepage", {"name" : "src_uri", "value" : "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"}]
vars_after_keywords = \
["depend", "rdepend"]
diff --git a/gs_pypi/ebuild.py b/gs_pypi/ebuild.py
index 74ba910..d3f5342 100644
--- a/gs_pypi/ebuild.py
+++ b/gs_pypi/ebuild.py
@@ -24,8 +24,8 @@ class PypiEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
def __init__(self, package_db):
vars_before_inherit = \
- [("repo_uri", 'http://pypi.python.org/packages/source/${PN:0:1}/${PN}/'),
- ("sourcefile", '${P}.tar.gz'), "python_compat"]
+ [{"name" : "repo_uri", "value" : 'http://pypi.python.org/packages/source/${PN:0:1}/${PN}/'},
+ {"name" : "sourcefile", "value" : '${P}.tar.gz'}, {"name" : "python_compat", "raw" : True}]
inherit = ["gs-pypi"]
@@ -43,13 +43,13 @@ class PypiEbuildWithDigestGenerator(DefaultEbuildGenerator):
def __init__(self, package_db):
vars_before_inherit = \
- [("digest_sources", "yes"), "python_compat"]
+ [{"name" : "digest_sources", "value" : "yes"}, {"name" : "python_compat", "raw" : True}]
inherit = ["gs-pypi"]
vars_after_description = \
["homepage",
- ("src_uri", 'http://pypi.python.org/packages/source/${PN:0:1}/${PN}/${P}.tar.gz')]
+ {"name" : "src_uri", "value" : 'http://pypi.python.org/packages/source/${PN:0:1}/${PN}/${P}.tar.gz'}]
vars_after_keywords = \
[]