contrib/pycrosswalk.git
9 years agoupdated changelog tizen submit/contrib/20150120.152220
Patrick Ohly [Fri, 19 Sep 2014 09:47:51 +0000 (11:47 +0200)]
updated changelog

9 years agoinitial packaging of the 20140919 master branch
Patrick Ohly [Fri, 19 Sep 2014 09:46:53 +0000 (11:46 +0200)]
initial packaging of the 20140919 master branch

gyp is bundled, as it is in other packages using it.

9 years agobundle gyp
Patrick Ohly [Fri, 19 Sep 2014 10:04:47 +0000 (12:04 +0200)]
bundle gyp

This is the same approach as used in other Crosswalk projects.
Could be replaced with a Tizen gyp package if someone was willing
to maintain it.

9 years agotizen: libpython2.7.so suffix
Patrick Ohly [Fri, 19 Sep 2014 09:45:11 +0000 (11:45 +0200)]
tizen: libpython2.7.so suffix

Other distros provide a libpython2.7.so.1 symlink to the real
file. On Tizen, only the real file is available, so use that.

9 years agoMerge pull request #2 from pohly/master upstream upstream/20140919
Thiago Marcos P. Santos [Fri, 19 Sep 2014 09:23:13 +0000 (12:23 +0300)]
Merge pull request #2 from pohly/master

use libffi and enable multithreading

9 years agoenable multithreading
Patrick Ohly [Fri, 19 Sep 2014 08:45:57 +0000 (10:45 +0200)]
enable multithreading

Python is single-threaded by default and crashes (when using an
unitialized semaphore) respectively blocks (when the main thread still
holds the Python global interpreter lock when it is outside the
pycrosswalk extension).

To avoid this, pycrosswalk must initialize multithreading and be more
careful about entering/leaving methods using Python.

The thread in which XW_Initialize() gets called becomes the main thread.
It must release the global lock when returning to Crosswalk and restore
it when called again. Otherwise Python code called by other threads cannot
run. The assumption is that Crosswalk will always call the extension from
the same thread.

Without this thread support, pycloudeebus in xwalk-launcher does not work:
the main thread is running the glib event loop in which twisted reacts
to D-Bus calls, while the second thread runs a Crosswalk event loop and
would hold the Python lock if we didn't release it.

9 years agoadding some disabled logging
Patrick Ohly [Fri, 19 Sep 2014 08:38:32 +0000 (10:38 +0200)]
adding some disabled logging

These printf()s were useful when debugging why Cloudeebus was unable
to process incoming D-Bus communication. Instead of adding them
manually each time they are needed, let's keep them in the code,
disabled via a single define.

9 years agolibffcall -> libffi
Patrick Ohly [Tue, 16 Sep 2014 07:59:56 +0000 (09:59 +0200)]
libffcall -> libffi

This replaces libffcall with libffi for binding the PyObject callback into
the plain C callback for the Crosswalk engine.

The advantage of libffi is more active maintance (?) and wider range
of projects using it, the more liberal license, and availability
(Tizen has libffi, but not libffcall).

10 years agoMerge pull request #1 from pohly/master
Thiago Marcos P. Santos [Mon, 30 Jun 2014 16:10:16 +0000 (09:10 -0700)]
Merge pull request #1 from pohly/master

Python 2.7 support

10 years agosupport Python 2.7
Patrick Ohly [Fri, 20 Jun 2014 08:39:55 +0000 (10:39 +0200)]
support Python 2.7

Module initialization was done differently in Python 2.x.

The code should also work with different Python versions. What ties it
to 2.7 at the moment is only the dlopen(RTLD_GLOBAL) hack that is also
tying it to 3.3 instead of some arbitrary 3.x version.

The latest available Python developer files are picked by configure.
This can be overriden by passing "-D python_version=2.7/3.3".

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
10 years agofix Python.h include order
Patrick Ohly [Fri, 20 Jun 2014 08:31:01 +0000 (10:31 +0200)]
fix Python.h include order

Python.h must be included before system headers to avoid preprocessor
warnings (see https://docs.python.org/2/extending/extending.html).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
10 years agoSupport multiple python extensions
Thiago Marcos P. Santos [Thu, 26 Jun 2014 13:30:42 +0000 (16:30 +0300)]
Support multiple python extensions

We trick Crosswalk to load multiple extensions using symbolic links, but
the reality is the extension only gets loaded once. The dynamic loader is smart
enough to figure that out.

So all the globals we have on the pycrosswalk plugin are shared. This is
fine, but we need to make sure that the next python extension being
loaded does not overwrite the callbacks set for the current extension.

The only tricky part was with the "instance_created/destroyed" callback,
which needed to be implemented using a closure library for C
(libffcall). I gave it for granted that closures were not possible in C,
but apparently it is using some stack manipulation magic.

10 years agoExpose the instance_[created/destroyed] callback to python
Thiago Marcos P. Santos [Thu, 26 Jun 2014 13:30:29 +0000 (16:30 +0300)]
Expose the instance_[created/destroyed] callback to python

10 years agoLoad the python module based on the plugin name
Thiago Marcos P. Santos [Wed, 25 Jun 2014 15:09:50 +0000 (18:09 +0300)]
Load the python module based on the plugin name

pycrosswalk will look for a python module with the same as the plugin
(without the lib prefix and the .so extension on Linux) and at the same
directory as the plugin. PYXWALK_PATH is not needed anymore.

For instance, let's suppose the symbolic link bellow:

  /home/foo/libfoobar.so -> /usr/lib/pyxwalk/libpycrosswalk.so

The loader will try to load the following module:

  /home/foo/foobar.py

For the following command line:

  ./xwalk --external-extensions-path=/home/foo/

10 years agoAdded the Crosswalk Extensions Runtime header
Thiago Marcos P. Santos [Wed, 25 Jun 2014 15:09:02 +0000 (18:09 +0300)]
Added the Crosswalk Extensions Runtime header

Needed to access the runtime variables passed by Crosswalk.

10 years agoFix the ownership of a string buffer
Thiago Marcos P. Santos [Mon, 16 Jun 2014 12:58:26 +0000 (15:58 +0300)]
Fix the ownership of a string buffer

When parsing the function arguments, the string buffer is owned by the
python interpretor. We need to make a duplicate if we want to make
further use of this buffer.

10 years agoFixed library path
Thiago Marcos P. Santos [Mon, 5 May 2014 14:34:58 +0000 (17:34 +0300)]
Fixed library path

10 years agoDebianized
Thiago Marcos P. Santos [Fri, 2 May 2014 09:18:44 +0000 (12:18 +0300)]
Debianized

10 years agoAdded LICENSE file
Thiago Marcos P. Santos [Fri, 2 May 2014 08:03:16 +0000 (11:03 +0300)]
Added LICENSE file

10 years agoInitial commit
Thiago Marcos P. Santos [Tue, 15 Apr 2014 12:43:10 +0000 (15:43 +0300)]
Initial commit