diff options
author | Jim Ramsay <lack@gentoo.org> | 2010-04-01 16:56:13 +0000 |
---|---|---|
committer | Jim Ramsay <lack@gentoo.org> | 2010-04-01 16:56:13 +0000 |
commit | 654a168d657eada8d2edfc25862c5b12bc0894c3 (patch) | |
tree | fedf599ff900aea69b5205f144518eeece74fd4a /rox-base/zeroinstall-injector | |
parent | version bump with patch from Denilson (bug #301789) (diff) | |
download | gentoo-2-654a168d657eada8d2edfc25862c5b12bc0894c3.tar.gz gentoo-2-654a168d657eada8d2edfc25862c5b12bc0894c3.tar.bz2 gentoo-2-654a168d657eada8d2edfc25862c5b12bc0894c3.zip |
Update to better deal with python3 and multiple python ABIs
(Portage version: 2.1.8.3/cvs/Linux i686)
Diffstat (limited to 'rox-base/zeroinstall-injector')
-rw-r--r-- | rox-base/zeroinstall-injector/ChangeLog | 8 | ||||
-rwxr-xr-x | rox-base/zeroinstall-injector/files/0distutils-r2 | 116 | ||||
-rw-r--r-- | rox-base/zeroinstall-injector/zeroinstall-injector-0.43-r1.ebuild (renamed from rox-base/zeroinstall-injector/zeroinstall-injector-0.43.ebuild) | 32 |
3 files changed, 142 insertions, 14 deletions
diff --git a/rox-base/zeroinstall-injector/ChangeLog b/rox-base/zeroinstall-injector/ChangeLog index 3047f1d7482d..6c3d4c4079d9 100644 --- a/rox-base/zeroinstall-injector/ChangeLog +++ b/rox-base/zeroinstall-injector/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for rox-base/zeroinstall-injector # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/rox-base/zeroinstall-injector/ChangeLog,v 1.20 2010/03/31 12:53:22 lack Exp $ +# $Header: /var/cvsroot/gentoo-x86/rox-base/zeroinstall-injector/ChangeLog,v 1.21 2010/04/01 16:56:12 lack Exp $ + +*zeroinstall-injector-0.43-r1 (01 Apr 2010) + + 01 Apr 2010; Jim Ramsay <lack@gentoo.org> +files/0distutils-r2, + -zeroinstall-injector-0.43.ebuild, +zeroinstall-injector-0.43-r1.ebuild: + Update to better deal with python3 and multiple python ABIs 31 Mar 2010; Jim Ramsay <lack@gentoo.org> -files/0distutils, -zeroinstall-injector-0.33.ebuild: diff --git a/rox-base/zeroinstall-injector/files/0distutils-r2 b/rox-base/zeroinstall-injector/files/0distutils-r2 new file mode 100755 index 000000000000..05c1eca54e8e --- /dev/null +++ b/rox-base/zeroinstall-injector/files/0distutils-r2 @@ -0,0 +1,116 @@ +#!/usr/bin/python2 + +import os +from xml.dom import minidom +import xml.dom + +ns0compile = "http://zero-install.sourceforge.net/2006/namespaces/0compile" + +def escape(uri): + import zeroinstall.injector.model + return zeroinstall.injector.model._pretty_escape(uri) + +def cacheescape(uri): + import zeroinstall.injector.model + return zeroinstall.injector.model.escape(uri) + +def strip(node): + torm = [] + for c in node.childNodes: + if c.nodeType == xml.dom.Node.TEXT_NODE and \ + c.nodeValue.strip() == "": + torm.append(c) + elif c.hasChildNodes(): + strip(c) + for c in torm: + node.removeChild(c) + c.unlink() + +class LocalFeed(object): + def __init__(self, xmlfile): + self.xml = minidom.parse(xmlfile) + if self.xml.documentElement.nodeName != "interface": + raise TypeError("Not an interface") + strip(self.xml.documentElement) + + def getUri(self): + for element in self.xml.documentElement.getElementsByTagName("feed-for"): + if element.hasAttribute("interface"): + return element.getAttribute("interface") + return None + + def edit(self, id=".", main="AppRun", stability="packaged"): + for attribute in ("main", "uri"): + if self.xml.documentElement.hasAttribute(attribute): + self.xml.documentElement.removeAttribute(attribute) + for group in self.xml.documentElement.getElementsByTagName("group"): + group.setAttribute("main", "AppRun") + if group.hasAttribute("arch") and group.getAttribute("arch") == "*-src": + uname = os.uname() + group.setAttribute("arch", "%s-%s" % (uname[0], uname[-1])) + attr0comp = [] + for aidx in range(0, group.attributes.length): + attr = group.attributes.item(aidx) + if attr.namespaceURI == ns0compile: + attr0comp.append(attr) + for attr in attr0comp: + group.removeAttributeNode(attr) + reqlist = group.getElementsByTagName("requires") + for req in reqlist: + group.removeChild(req) + req.unlink() + for imp in group.getElementsByTagName("implementation"): + imp.setAttribute("stability",stability) + imp.setAttribute("id",id) + + def dump(self): + print self.xml.toprettyxml() + +def main(xmlfile, mode="edit"): + try: + feed = LocalFeed(xmlfile) + if mode == "uri": + print feed.getUri() + elif mode == "escape": + print escape(feed.getUri()) + elif mode == "cache": + print cacheescape(feed.getUri()) + else: + feed.edit() + feed.dump() + except Exception, e: + import sys + print "Fatal:", e + sys.exit(2) + +def usage(program): + import os.path + progname = os.path.basename(program) + print "Usage:", progname, "[-u|-e] <xmlfile>" + print "Options:" + print "\t-u --uri: Finds the URI from the feed" + print "\t-e --escape: Escapes the URI from the feed" + +if __name__ == "__main__": + from optparse import OptionParser + import sys + parser = OptionParser(usage="usage: %prog [options] feed.xml", + description="By default, edits the given feed and prints the result on stdout.") + parser.add_option("-e", "--escape", action="store_const", + const="escape", dest="mode", + help="Return the cache-escaped URI from the feed on stdout.") + parser.add_option("-c", "--cache", action="store_const", + const="cache", dest="mode", + help="Return the file-escaped URI from the feed on stdout.") + parser.add_option("-u", "--uri", action="store_const", + const="uri", dest="mode", + help="Return the original URI from the feed on stdout.") + (options, args) = parser.parse_args() + if len(args) == 0: + parser.print_help() + else: + if len(args) > 1: + parser.error("requires exactly one .xml file") + main(args[0], options.mode) + +# vim: nosta noet sw=4 ts=4 diff --git a/rox-base/zeroinstall-injector/zeroinstall-injector-0.43.ebuild b/rox-base/zeroinstall-injector/zeroinstall-injector-0.43-r1.ebuild index aac46292783b..be91f08a4596 100644 --- a/rox-base/zeroinstall-injector/zeroinstall-injector-0.43.ebuild +++ b/rox-base/zeroinstall-injector/zeroinstall-injector-0.43-r1.ebuild @@ -1,8 +1,12 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/rox-base/zeroinstall-injector/zeroinstall-injector-0.43.ebuild,v 1.1 2010/01/12 13:33:58 lack Exp $ +# $Header: /var/cvsroot/gentoo-x86/rox-base/zeroinstall-injector/zeroinstall-injector-0.43-r1.ebuild,v 1.1 2010/04/01 16:56:12 lack Exp $ -EAPI=2 +EAPI=3 +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.*" +PYTHON_DEPEND="2" +PYTHON_USE_WITH="xml" inherit distutils DESCRIPTION="Zeroinstall Injector allows regular users to install software themselves" @@ -16,21 +20,31 @@ IUSE="" DEPEND="!<=rox-base/rox-session-0.30" RDEPEND=">=dev-python/pygtk-2.0 - app-crypt/gnupg - dev-lang/python[xml]" + app-crypt/gnupg" PYTHON_MODNAME="zeroinstall" src_prepare() { # Change manpage install path (Bug 207495) sed -i 's:man/man1:share/man/man1:' setup.py + cp "${FILESDIR}/0distutils-r2" "${WORKDIR}/0distutils" +} + +src_compile() { + distutils_src_compile } src_install() { distutils_src_install + fix_0launch_gui() { + python_convert_shebangs "${PYTHON_ABI}" \ + "${ED}$(python_get_sitedir)/zeroinstall/0launch-gui/0launch-gui" + } + python_execute_function -q fix_0launch_gui + exeinto "/usr/sbin/" - newexe "${FILESDIR}/0distutils-r1" 0distutils + doexe "${WORKDIR}/0distutils" local BASE_XDG_CONFIG="/etc/xdg/0install.net" local BASE_XDG_DATA="/usr/share/0install.net" @@ -40,11 +54,3 @@ src_install() { dodir "${BASE_XDG_DATA}/native_feeds" } - -pkg_postinst() { - python_version - # Note: Must use '-f' because python_mod_optimize sometimes leaves old files - # around. - python_mod_optimize -f \ - /usr/$(get_libdir)/python${PYVER}/site-packages/zeroinstall -} |