diff options
author | Michael Palimaka <kensington@gentoo.org> | 2012-08-02 13:34:05 +0000 |
---|---|---|
committer | Michael Palimaka <kensington@gentoo.org> | 2012-08-02 13:34:05 +0000 |
commit | d289ba7db896f62d3e65b4c1fd2979d3b706ef59 (patch) | |
tree | 40a87037905b38cd6e1b9cd7cd96170ce0e4abe1 /kde-base | |
parent | seems someone doesn't know FILESDIR needs quoting... (diff) | |
download | gentoo-2-d289ba7db896f62d3e65b4c1fd2979d3b706ef59.tar.gz gentoo-2-d289ba7db896f62d3e65b4c1fd2979d3b706ef59.tar.bz2 gentoo-2-d289ba7db896f62d3e65b4c1fd2979d3b706ef59.zip |
Use the updated python wrapper for pykde-4.9.0 only.
(Portage version: 2.1.11.9/cvs/Linux x86_64)
Diffstat (limited to 'kde-base')
-rw-r--r-- | kde-base/pykde4/ChangeLog | 8 | ||||
-rw-r--r-- | kde-base/pykde4/files/kpythonpluginfactorywrapper.c | 10 | ||||
-rw-r--r-- | kde-base/pykde4/files/kpythonpluginfactorywrapper.c-r1 | 60 | ||||
-rw-r--r-- | kde-base/pykde4/pykde4-4.9.0.ebuild | 4 |
4 files changed, 69 insertions, 13 deletions
diff --git a/kde-base/pykde4/ChangeLog b/kde-base/pykde4/ChangeLog index 66397a8ac12b..84b7af2a72ce 100644 --- a/kde-base/pykde4/ChangeLog +++ b/kde-base/pykde4/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for kde-base/pykde4 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/pykde4/ChangeLog,v 1.165 2012/08/01 22:17:17 johu Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/pykde4/ChangeLog,v 1.166 2012/08/02 13:34:05 kensington Exp $ + + 02 Aug 2012; Michael Palimaka <kensington@gentoo.org> + +files/kpythonpluginfactorywrapper.c-r1, files/kpythonpluginfactorywrapper.c, + pykde4-4.9.0.ebuild: + Use the updated python wrapper for pykde-4.9.0 only. *pykde4-4.9.0 (01 Aug 2012) @@ -678,4 +683,3 @@ +metadata.xml, +pykde4-4.1.2.ebuild: Added pykde4-4.1.2. Thanks to jkt for the ebuild. First fix for bug 214408. - diff --git a/kde-base/pykde4/files/kpythonpluginfactorywrapper.c b/kde-base/pykde4/files/kpythonpluginfactorywrapper.c index b5d152f4b5cd..3915a0d122be 100644 --- a/kde-base/pykde4/files/kpythonpluginfactorywrapper.c +++ b/kde-base/pykde4/files/kpythonpluginfactorywrapper.c @@ -34,18 +34,10 @@ static void init() { char buf[VERSION_LEN + 1]; memset(buf, 0, VERSION_LEN + 1); get_python_version(buf); - char *s = buf; - while(*s != '\0') { - if(*s == '\n') { - *s = '\0'; - break; - } - ++s; - } int length = strlen(FORMAT) + strlen(buf) + 1; char *name = malloc(length + 1); snprintf(name, length, FORMAT, buf); - handle = dlopen(name, RTLD_NOW); + void *handle = dlopen(name, RTLD_NOW); free(name); wrapped_qt_plugin_instance = dlsym(handle, "qt_plugin_instance"); } diff --git a/kde-base/pykde4/files/kpythonpluginfactorywrapper.c-r1 b/kde-base/pykde4/files/kpythonpluginfactorywrapper.c-r1 new file mode 100644 index 000000000000..b5d152f4b5cd --- /dev/null +++ b/kde-base/pykde4/files/kpythonpluginfactorywrapper.c-r1 @@ -0,0 +1,60 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define VERSION_LEN 10 + +#define FORMAT EPREFIX PLUGIN_DIR "/kpython%spluginfactory.so" + +static void *handle; +static void *(*wrapped_qt_plugin_instance)(); + +static void get_python_version(char* out) { + int pipefd[2]; + pipe(pipefd); + pid_t cpid = fork(); + if (cpid == 0) { + close(pipefd[1]); + read(pipefd[0], out, VERSION_LEN); + } else { + close(pipefd[0]); + close(1); + dup2(pipefd[1], 1); + close(pipefd[1]); + close(0); + char *args[] = { "eselect", "python", "show", "--ABI", "--python2", 0 }; + execv(EPREFIX "/usr/bin/eselect", args); + } +} + +__attribute__((constructor)) +static void init() { + char buf[VERSION_LEN + 1]; + memset(buf, 0, VERSION_LEN + 1); + get_python_version(buf); + char *s = buf; + while(*s != '\0') { + if(*s == '\n') { + *s = '\0'; + break; + } + ++s; + } + int length = strlen(FORMAT) + strlen(buf) + 1; + char *name = malloc(length + 1); + snprintf(name, length, FORMAT, buf); + handle = dlopen(name, RTLD_NOW); + free(name); + wrapped_qt_plugin_instance = dlsym(handle, "qt_plugin_instance"); +} + +__attribute__((destructor)) +static void fini() { + dlclose(handle); +} + +void *qt_plugin_instance() { + return wrapped_qt_plugin_instance(); +} diff --git a/kde-base/pykde4/pykde4-4.9.0.ebuild b/kde-base/pykde4/pykde4-4.9.0.ebuild index 1128ed321aa6..7d274e768c4e 100644 --- a/kde-base/pykde4/pykde4-4.9.0.ebuild +++ b/kde-base/pykde4/pykde4-4.9.0.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/pykde4/pykde4-4.9.0.ebuild,v 1.1 2012/08/01 22:17:17 johu Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/pykde4/pykde4-4.9.0.ebuild,v 1.2 2012/08/02 13:34:05 kensington Exp $ EAPI=4 @@ -65,7 +65,7 @@ src_prepare() { if ${have_python2}; then mkdir -p "${WORKDIR}/wrapper" || die "failed to copy wrapper" - cp "${FILESDIR}/kpythonpluginfactorywrapper.c" "${WORKDIR}/wrapper" || die "failed to copy wrapper" + cp "${FILESDIR}/kpythonpluginfactorywrapper.c-r1" "${WORKDIR}/wrapper/kpythonpluginfactorywrapper.c" || die "failed to copy wrapper" fi } |