public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Jauhien Piatlicki" <piatlicki@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/g-sorcery:master commit in: g_sorcery/, gs_pypi/, gs_ctan/, gs_elpa/
Date: Thu,  5 Sep 2013 11:54:35 +0000 (UTC)	[thread overview]
Message-ID: <1378382052.71062a6167f767e15a22ac10edd996b3cad667a3.jauhien@gentoo> (raw)

commit:     71062a6167f767e15a22ac10edd996b3cad667a3
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Thu Sep  5 11:54:12 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Thu Sep  5 11:54:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=71062a61

variables without quotation in ebuild-generator

---
 g_sorcery/ebuild.py | 19 +++++++++++++------
 gs_ctan/ebuild.py   |  6 +++---
 gs_elpa/ebuild.py   |  4 ++--
 gs_pypi/ebuild.py   |  8 ++++----
 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 = \
           []


                 reply	other threads:[~2013-09-05 11:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1378382052.71062a6167f767e15a22ac10edd996b3cad667a3.jauhien@gentoo \
    --to=piatlicki@gmail.com \
    --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