diff options
author | Larry Hajali <larryhaja[at]gmail[dot]com> | 2010-05-12 23:31:19 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-12 23:31:19 +0200 |
commit | ca0f5478ada1e04bf8ef6f855f2b96dbbfefd475 (patch) | |
tree | 97e1f287322158ecda67c0963034b109d42c7749 | |
parent | 89d2de7999fa5460a46d6d05bf14edb8e41475b8 (diff) | |
download | slackbuilds-ca0f5478ada1e04bf8ef6f855f2b96dbbfefd475.tar.gz |
libraries/python-spidermonkey: Added to 12.2 repository
-rw-r--r-- | libraries/python-spidermonkey/README | 4 | ||||
-rw-r--r-- | libraries/python-spidermonkey/README.md | 119 | ||||
-rw-r--r-- | libraries/python-spidermonkey/python-spidermonkey.SlackBuild | 54 | ||||
-rw-r--r-- | libraries/python-spidermonkey/python-spidermonkey.info | 8 | ||||
-rw-r--r-- | libraries/python-spidermonkey/setuptools.diff | 13 | ||||
-rw-r--r-- | libraries/python-spidermonkey/slack-desc | 19 |
6 files changed, 217 insertions, 0 deletions
diff --git a/libraries/python-spidermonkey/README b/libraries/python-spidermonkey/README new file mode 100644 index 0000000000..c1395b00a0 --- /dev/null +++ b/libraries/python-spidermonkey/README @@ -0,0 +1,4 @@ +Python/JavaScript bridge module, making use of Mozilla's spidermonkey +JavaScript implementation. + +This requires js and pysetuptools. diff --git a/libraries/python-spidermonkey/README.md b/libraries/python-spidermonkey/README.md new file mode 100644 index 0000000000..0f5f823cde --- /dev/null +++ b/libraries/python-spidermonkey/README.md @@ -0,0 +1,119 @@ + +Execute arbitrary JavaScript code from Python. Allows you to reference +arbitrary Python objects and functions in the JavaScript VM + +Requirements +============ + +Python Development Files +------------------------ + +Mac OS X: + +If you installed Python via port then the headers should already be installed. +I have not heard reports of problems from people using the bundled +interpreters. + +Debian/Ubuntu: + + $ sudo apt-get install pythonX.X-dev + +Where X.X is the version of Python you are using. I have not tested +python-spidermonkey on Py3K so it may be horribly broken there. + +Netscape Portable Runtime (nspr) +-------------------------------- + +The nspr library is required for building the Spidermonkey sources. You should +be able to grab it from your package manager of choice with something like the +following: + +Mac OS X: + + $ sudo port install nspr + +Debian/Ubuntu: + + $ sudo apt-get install libnspr4-dev + +Alternatively you can build from [source][nspr]. If you choose this route make +sure that the nspr-config command is on your $PATH when running the install +commands below. + +Installation +============ + + $ git clone git://github.com/davisp/python-spidermonkey.git + $ cd python-spidermonkey + $ python setup.py build + $ python setup.py test + + $ sudo python setup.py install + + *OR* + + $ sudo python setup.py develop + +Having Issues? +============== + +Add issues to the Lighthouse project [here][lh]. + + +Examples +======== + +Basics +------ + + >>> import spidermonkey + >>> rt = spidermonkey.Runtime() + >>> cx = rt.new_context() + >>> cx.execute("var x = 3; x *= 4; x;") + 12 + >>> class Orange(object): + ... def is_ripe(self,arg): + ... return "ripe %s" % arg + ... + >>> fruit = Orange() + >>> cx.add_global("apple", fruit) + >>> cx.execute('"Show me the " + apple.is_ripe("raisin");') + Show me the ripe raisin + +Playing with Classes +-------------------- + + >>> import spidermonkey + >>> class Monkey(object): + ... def __init__(self): + ... self.baz = "blammo" + ... def wrench(self, arg): + ... return "%s now wrenched" % arg + ... + >>> rt = spidermonkey.Runtime() + >>> cx = rt.new_context() + >>> cx.add_global(Monkey) + >>> monkey = cx.execute('var x = new Monkey(); x.baz = "schmammo"; x;') + >>> monkey.baz + 'schmammo' + >>> monkey.__class__.__name__ + 'Monkey' + +JavaScript Functions +-------------------- + + >>> import spidermonkey + >>> rt = spidermonkey.Runtime() + >>> cx = rt.new_context() + >>> func = cx.execute('function(val) {return "whoosh: " + val;}') + >>> func("zipper!"); + 'whoosh: zipper!' + +Previous Authors +================ + +* John J. Lee +* Atul Varma + +[lh]: http://davisp.lighthouseapp.com/projects/26898-python-spidermonkey/overview +[nspr]: ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases diff --git a/libraries/python-spidermonkey/python-spidermonkey.SlackBuild b/libraries/python-spidermonkey/python-spidermonkey.SlackBuild new file mode 100644 index 0000000000..e6db25b25f --- /dev/null +++ b/libraries/python-spidermonkey/python-spidermonkey.SlackBuild @@ -0,0 +1,54 @@ +#!/bin/sh +# Slackware build script for python-spidermonkey +# Written by Larry Hajali <larryhaja[at]gmail[dot]com> + +PRGNAM=python-spidermonkey +VERSION=${VERSION:-0.0.5} +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Get rid of ez_setup. +patch -p1 < $CWD/setuptools.diff +# Use the spidermonkey nspr. +sed -i 's|nspr-config|seamonkey-config|' setup.py + +python setup.py install --root="${PKG}" + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE $PKG/usr/doc/$PRGNAM-$VERSION +install -m 0644 $CWD/README.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/libraries/python-spidermonkey/python-spidermonkey.info b/libraries/python-spidermonkey/python-spidermonkey.info new file mode 100644 index 0000000000..65b0804935 --- /dev/null +++ b/libraries/python-spidermonkey/python-spidermonkey.info @@ -0,0 +1,8 @@ +PRGNAM="python-spidermonkey" +VERSION="0.0.5" +HOMEPAGE="http://pypi.python.org/pypi/python-spidermonkey" +DOWNLOAD="http://pypi.python.org/packages/source/p/python-spidermonkey/python-spidermonkey-0.0.5.tar.gz" +MD5SUM="484c882b675e6519e97e384eeff75ee3" +MAINTAINER="Larry Hajali" +EMAIL="larryhaja[at]gmail[dot]com" +APPROVED="rworkman" diff --git a/libraries/python-spidermonkey/setuptools.diff b/libraries/python-spidermonkey/setuptools.diff new file mode 100644 index 0000000000..86d33abbc3 --- /dev/null +++ b/libraries/python-spidermonkey/setuptools.diff @@ -0,0 +1,13 @@ +diff -Naur python-spidermonkey-0.0.5.orig/setup.py python-spidermonkey-0.0.5/setup.py +--- python-spidermonkey-0.0.5.orig/setup.py 2009-03-13 20:04:25.000000000 +0000 ++++ python-spidermonkey-0.0.5/setup.py 2009-03-18 05:47:12.000000000 +0000 +@@ -16,8 +16,7 @@ + import os + import subprocess as sp + import sys +-import ez_setup +-ez_setup.use_setuptools() ++import setuptools + from setuptools import setup, Extension + + def find_sources(extensions=[".c", ".cpp"]): diff --git a/libraries/python-spidermonkey/slack-desc b/libraries/python-spidermonkey/slack-desc new file mode 100644 index 0000000000..a0a5b01d18 --- /dev/null +++ b/libraries/python-spidermonkey/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +python-spidermonkey: python-spidermonkey +python-spidermonkey: +python-spidermonkey: Python/JavaScript bridge module, making use of Mozilla's spidermonkey +python-spidermonkey: JavaScript implementation. +python-spidermonkey: +python-spidermonkey: Homepage: http://pypi.python.org/pypi/python-spidermonkey +python-spidermonkey: +python-spidermonkey: +python-spidermonkey: +python-spidermonkey: +python-spidermonkey: |