[announce] PyV8 v0.7 (first beta)

7 views
Skip to first unread message

Flier Lu

unread,
Sep 2, 2009, 11:22:53 AM9/2/09
to PyV8
Features:

support Linux x64 platform
support to enumerate object properties with "for v in o" syntax
support __call__(*args, **kwds) style function call
add javascript base web server example (demo/node.py|.js)

Bug Fixed:

Issue#6, check the None object when compare two Javascript objects
Issue#5, check message pointer before throw the exception
Issue#4, throw exception when the context missing
Issue#3, support to convert JSObject to dict, and return dict as
object
Issue#2, support the UNICODE string with UTF-8 encoding

Minor Changes:

Use environment variable for 3rd party libraries
support to print call stacks to FILE object
return native python type as javascript function result
support two way conversion between JS Date and Python datetime
objects

Known Issues:

The length of unicode string is different at x86 and x64 platform
The security token is still be broken

Artur Ventura

unread,
Sep 3, 2009, 9:45:53 AM9/3/09
to PyV8
Nice, I was hoping for Issue 4 & Issue 2 to be resolved

I had to hammer setup.py to compile pyv8 under Snow Leopard. Also I
had to change the default compiler. Do you want the patch ?

Flier Lu

unread,
Sep 3, 2009, 12:13:12 PM9/3/09
to py...@googlegroups.com
Great, I will merge your patch to the branch, but I haven't a mac to test it :P

2009/9/3 Artur Ventura <artur....@gmail.com>

Artur Ventura

unread,
Sep 3, 2009, 2:20:22 PM9/3/09
to PyV8
The patch is as follows:

--- setup.py 2009-09-03 14:42:52.000000000 +0100
+++ ../PyV8-0.7 2/setup.py 2009-09-01 11:00:54.000000000 +0100
@@ -8,10 +8,8 @@

include_dirs = [
os.path.join(os.environ.get('V8_HOME'), 'include'),
- os.path.join(os.environ.get('BOOST_HOME'))
-
]
-library_dirs = [os.path.join('/lib')]
+library_dirs = []
libraries = []
extra_compile_args = []
extra_link_args = []
@@ -38,7 +36,7 @@
os.environ.get('V8_HOME'),
]

- libraries = ["boost_python-xgcc40-mt", "v8", "c"]
+ libraries = ["boost_python", "v8", "rt"]

pyv8 = Extension(name = "_PyV8",
sources = [os.path.join("src", file) for file in
source_files],


There's a few caveats:

1) The default compiler in snow leopard doesn't seem able to compile
PyV8. I couldn't find the problem, but works if you revert to gcc-4.0,
by temporarily setting the enviroment variables to:

export CC="gcc-4.0"
export CXX="g++-4.0"

Probably setup.py could temporarily change it.

2) librt doesn't exist in mac os x. Actually it's been deprecated for
more than 10 years (http://freshmeat.net/projects/librt/). I replaced
it with libc.

3) Mac OS X doesn't come with boost, so I had to compile it. And
because i didn't configure it correctly, it was installed in /lib.
That's why the '/lib' is in the library_dirs. This can probably be
configured to use the BOOST_HOME or something. More so, the library
name for boost_python in my system is "boost_python-xgcc40-mt". This
might be other thing that probably should be passed by some kind of
configure.


On Sep 3, 5:13 pm, Flier Lu <flier...@gmail.com> wrote:
> Great, I will merge your patch to the branch, but I haven't a mac to test it
> :P
>
> 2009/9/3 Artur Ventura <artur.vent...@gmail.com>

Flier Lu

unread,
Sep 4, 2009, 11:23:50 PM9/4/09
to py...@googlegroups.com
Thanks, your comments are very detail :)

So, can I collect your changes to a branch base on os.name ?

elif os.name == "mac": # contribute by Artur Ventura (need email?)
  include_dirs += [
    os.environ.get('BOOST_HOME'),
  ]
  library_dirs += [os.path.join('/lib')]
  libraries += ["boost_python-xgcc40-mt", "v8", "c"]

My concern is the boost_python-xgcc40-mt contain too many compiler special information, maybe we could use a symbol link to create a alias from it to boost_python?

2009/9/4 Artur Ventura <artur....@gmail.com>

Artur Ventura

unread,
Sep 7, 2009, 7:03:43 AM9/7/09
to PyV8, Flier Lu
Yes you can collect my changes. My email if you want is artur.ventura
at gmail dot com

About the boost, you can make something more interesting. this small
shell script will give you the keyword that you should place in ld:

ls *.dylib | grep "boost_python" | sed "s/lib\(boost_python.*\)\.dylib/
\1/" | head -n 1

This will look at the current directory for all the libboost_python
dyna link files, and return the keyword required to give to the
linker. This can be used directly at the command line as:

gcc ...... -l`ls *.dylib | grep "boost_python" | sed "s/lib\
(boost_python.*\)\.dylib/\1/" | head -n 1`

However you are using setup.py for the setup and I don't know how that
building system works, or even if you can use something like this.
Reply all
Reply to author
Forward
0 new messages