From 4da010ebb2f55849cf84e1341627a0548b2ee730 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 7 Jun 2011 20:53:20 -0400 Subject: [PATCH] Escape double quotes in urls to avoid invalid ebuild syntax. For example, modulegraph currently lists its url as url = http://bitbucket.org/ronaldoussoren/modulegraph" for which we want to produce HOMEPAGE="http://bitbucket.org/ronaldoussoren/modulegraph%22" not the invalid HOMEPAGE="http://bitbucket.org/ronaldoussoren/modulegraph"" --- g_pypi/ebuild.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/g_pypi/ebuild.py b/g_pypi/ebuild.py index 1dc55a3..151d984 100755 --- a/g_pypi/ebuild.py +++ b/g_pypi/ebuild.py @@ -141,6 +141,10 @@ class Ebuild: self.vars['my_pv'] = ebuild_vars['my_pv'] self.vars['src_uri'] = ebuild_vars['src_uri'] + def _quote(self, string): + """Escape double quotes to ensure valid ebuild syntax. + """ + return string.replace('"', '%22') def add_metadata(self): """ @@ -150,7 +154,7 @@ class Ebuild: homepages = ['Home-page', 'home_page', 'home-page'] for hpage in homepages: if self.metadata.has_key(hpage): - self.vars['homepage'] = self.metadata[hpage] + self.vars['homepage'] = self._quote(self.metadata[hpage]) #There doesn't seem to be any specification for case if self.metadata.has_key('Summary'): -- 2.26.2