summaryrefslogtreecommitdiff
path: root/python/python-spidermonkey
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2011-03-16 01:13:49 -0500
committerRobby Workman <rworkman@slackbuilds.org>2011-03-20 12:33:01 -0500
commit7a1b4848a3d34a263544fadf08178c91c12fbad0 (patch)
tree8987d0fc908e371dfa87445425f59c7514075b37 /python/python-spidermonkey
parent987d45e99a299c3b24418b2976e8ec9d5f3bf404 (diff)
downloadslackbuilds-7a1b4848a3d34a263544fadf08178c91c12fbad0.tar.gz
python/*: Moved a lot of Python stuff here
The criteria for whether something "belongs" in Development or Libraries or Python or ... is admittedly arbitrary. As a general rule, if it could be either Libraries or Python, it's Python. Otherwise, pick one and we'll go from there... Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'python/python-spidermonkey')
-rw-r--r--python/python-spidermonkey/README7
-rw-r--r--python/python-spidermonkey/README.md200
-rw-r--r--python/python-spidermonkey/python-spidermonkey.SlackBuild60
-rw-r--r--python/python-spidermonkey/python-spidermonkey.info10
-rw-r--r--python/python-spidermonkey/slack-desc19
5 files changed, 296 insertions, 0 deletions
diff --git a/python/python-spidermonkey/README b/python/python-spidermonkey/README
new file mode 100644
index 0000000000..9d6d6dd69a
--- /dev/null
+++ b/python/python-spidermonkey/README
@@ -0,0 +1,7 @@
+Python/JavaScript bridge module, making use of Mozilla's spidermonkey
+JavaScript implementation. Allows implementation of JavaScript classes,
+objects and functions in Python, and evaluation and calling of JavaScript
+scripts and functions respectively. Borrows heavily from Claes Jacobssen's
+Javascript Perl module, in turn based on Mozilla's 'PerlConnect' Perl binding.
+
+This requires pysetuptools, nose, and js.
diff --git a/python/python-spidermonkey/README.md b/python/python-spidermonkey/README.md
new file mode 100644
index 0000000000..1ddc3d1fe4
--- /dev/null
+++ b/python/python-spidermonkey/README.md
@@ -0,0 +1,200 @@
+Execute arbitrary JavaScript code from Python. Allows you to reference
+arbitrary Python objects and functions in the JavaScript VM
+
+Having issues?
+==============
+
+The project support site can be found at [lighthouseapp.com][lh].
+
+Requirements
+============
+
+Pkg-Config
+----------
+
+Mac OS X:
+
+This should be installed by default. If not there is a port package:
+
+ $ sudo port install pkgconfig
+
+Debian/Ubuntu:
+
+This is also generally installed by default, but I have reports of it being
+otherwise.
+
+ $ sudo apt-get install pkg-config
+
+Gentoo:
+
+ $ sudo emerge dev-util/pkgconfig
+
+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.
+
+Gentoo:
+
+If you have python installed, then the headers should already be installed.
+
+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
+
+Gentoo:
+
+ $ sudo emerge dev-libs/nspr
+
+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.
+
+If you choose this route make
+sure that the pkg-config command is on your `$PATH` when running the install
+commands below. Additionally, make sure that `$PKG_CONFIG_PATH` is properly
+set.
+
+XULRunner (optional)
+--------------------
+You can optionally build the extension linked to your system's spidermonkey
+library, which is installed with XULRunner. You should be able to grab it from
+your package manager of choice with something like the following:
+
+Mac OS X:
+
+ $ sudo port install xulrunner
+
+Debian/Ubuntu:
+
+ $ sudo apt-get install xulrunner-1.9-dev
+
+Gentoo:
+
+ $ sudo emerge net-libs/xulrunner
+
+As with [nspr][nspr], you can also build [xulrunner][xulrunner] from source. And as with [nspr][nspr] you need to make sure hat `$PATH` and `$PKG_CONFIG_PATH` are properly set when building the module.
+
+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
+
+If you want to build with the system spidermonkey library, replace the build
+command with the following:
+
+ $ python setup.py --system-library build
+
+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");')
+ u'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)
+ >>> monkey = cx.execute('var x = new Monkey(); x.baz = "schmammo"; x;')
+ >>> monkey.baz
+ u'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!");
+ u'whoosh: zipper!'
+
+
+Filtering access to Python
+--------------------------
+
+ >>> import spidermonkey
+ >>> rt = spidermonkey.Runtime()
+ >>> def checker(obj, name):
+ ... return not name.startswith("_")
+ ...
+ >>> cx = rt.new_context(access=checker)
+ >>> # Alternatively:
+ >>> cx.set_access() #doctest: +ELLIPSIS
+ <function checker at ...>
+ >>> cx.set_access(checker) #doctest: +ELLIPSIS
+ <function checker at ...>
+ >>> cx.add_global("fish", {"gold": "gone", "_old_lady": "huzza"})
+ >>> cx.execute('fish["_old_lady"];')
+ Traceback (most recent call last):
+ ...
+ JSError: Error executing JavaScript.
+
+
+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
+[xulrunner]: ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases
diff --git a/python/python-spidermonkey/python-spidermonkey.SlackBuild b/python/python-spidermonkey/python-spidermonkey.SlackBuild
new file mode 100644
index 0000000000..d4d7d3851d
--- /dev/null
+++ b/python/python-spidermonkey/python-spidermonkey.SlackBuild
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# Slackware build script for python-spidermonkey
+
+# Written by Larry Hajali <larryhaja[at]gmail[dot]com>
+
+PRGNAM=python-spidermonkey
+VERSION=${VERSION:-0.0.8}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+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.
+sed -i '/ez_setup/d' setup.py MANIFEST.in
+
+python setup.py install --root=$PKG
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/README.md > $PKG/usr/doc/$PRGNAM-$VERSION/README.md
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+chmod 0644 $PKG/usr/doc/$PRGNAM-$VERSION/*
+
+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.${PKGTYPE:-tgz}
diff --git a/python/python-spidermonkey/python-spidermonkey.info b/python/python-spidermonkey/python-spidermonkey.info
new file mode 100644
index 0000000000..fd538a7421
--- /dev/null
+++ b/python/python-spidermonkey/python-spidermonkey.info
@@ -0,0 +1,10 @@
+PRGNAM="python-spidermonkey"
+VERSION="0.0.8"
+HOMEPAGE="http://pypi.python.org/pypi/python-spidermonkey"
+DOWNLOAD="http://pypi.python.org/packages/source/p/python-spidermonkey/python-spidermonkey-0.0.8.tar.gz"
+MD5SUM="035ffc4650e2193a09dd4f81bc30fafd"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Larry Hajali"
+EMAIL="larryhaja[at]gmail[dot]com"
+APPROVED="rworkman"
diff --git a/python/python-spidermonkey/slack-desc b/python/python-spidermonkey/slack-desc
new file mode 100644
index 0000000000..a0a5b01d18
--- /dev/null
+++ b/python/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: