From: W. Trevor King Date: Wed, 8 Jun 2011 00:53:20 +0000 (-0400) Subject: Escape double quotes in urls to avoid invalid ebuild syntax. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4da010ebb2f55849cf84e1341627a0548b2ee730;p=g-pypi.git 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"" --- 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'):