Permalink
Browse files

Create ant targets for making distributions.

  • Loading branch information...
1 parent 85a0024 commit 22ee420172f320997e494e71d59f096b7d44686b @jdf committed Aug 18, 2010
View
@@ -12,3 +12,5 @@ generated/jycessing/*.java
build
processing-py.jar
libraries/peasycam
+dist
+
View
@@ -10,6 +10,9 @@ Write [Processing](http://processing.org) sketches in Python.
$ git clone git://github.com/jdf/processing.py.git
$ cd processing.py
$ ant
+
+ (or download a distribution from http://github.com/jdf/processing.py/downloads)
+
$ java -jar processing-py.jar examples.py/Basics/Math/NoiseField/noisefield.py
$ java -jar processing-py.jar examples.py/3D/Typography/KineticType/KineticType.py
$ java -jar processing-py.jar examples.py/Library/OpenGL/SpaceJunk/SpaceJunk.py
View
130 build.xml
@@ -8,53 +8,87 @@
jdf
====================================================================== -->
<project name="processing.py" default="jar">
- <description>
+ <description>
Write processing sketches in Python
- </description>
-
- <target name="jar" depends="build">
- <jar destfile="processing-py.jar">
- <fileset dir="bin" excludes="jycessing/build/**"/>
- <zipgroupfileset file="lib/jython/jython.jar"/>
- <zipgroupfileset file="lib/processing/core.jar"/>
- <manifest>
- <attribute name="Main-Class" value="jycessing.Runner" />
- </manifest>
- </jar>
- </target>
-
- <target name="build" depends="generate-driver">
- <mkdir dir="bin" />
- <javac
- classpath="lib/jython/jython.jar:lib/processing/core.jar"
- destdir="bin">
- <src path="src"/>
- <src path="generated"/>
- <exclude name="jycessing/build/**"/>
- </javac>
- </target>
-
- <target name="generate-driver"
- depends="build-driver-generator"
- description="Generate DriverImpl class">
- <java
- classpath="bin:lib/processing/core.jar"
- classname="jycessing.build.DriverGenerator"
- fork="true" />
- </target>
-
- <target name="build-driver-generator">
- <mkdir dir="bin" />
- <javac
- srcdir="src"
- includes="jycessing/build/**"
- classpath="lib/processing/core.jar"
- destdir="bin" />
- </target>
-
- <target name="clean">
- <delete dir="bin"/>
- <delete file="generated/jycessing/DriverImpl.java"/>
- <mkdir dir="bin"/>
- </target>
+ </description>
+
+ <target name="newversion" depends="bumpversion,clean,dist" />
+
+ <target name="dist" depends="jar">
+ <property file="src/jycessing/buildnumber.properties"
+ prefix="jycessing" />
+ <property name="dist" value="processing.py-${jycessing.buildnumber}" />
+ <delete dir="dist" />
+ <mkdir dir="dist/${dist}" />
+ <copy todir="dist/${dist}">
+ <fileset file="processing-py.jar" />
+ <fileset file="scripts/processing-py.bat" />
+ <fileset file="scripts/processing-py" />
+ <fileset file="LICENSE.txt" />
+ <fileset dir="."
+ includes="examples.py/**,libraries/processing/**" />
+ </copy>
+ <zip basedir="dist" includes="${dist}/**" destfile="dist/${dist}.zip" />
+ <tar compression="gzip"
+ basedir="dist"
+ includes="${dist}/**"
+ destfile="dist/${dist}.tgz" />
+ </target>
+
+ <target name="jar" depends="build">
+ <jar destfile="processing-py.jar">
+ <fileset dir="bin" excludes="jycessing/build/**" />
+ <zipgroupfileset file="lib/jython/jython.jar" />
+ <zipgroupfileset file="lib/processing/core.jar" />
+ <manifest>
+ <attribute name="Main-Class" value="jycessing.Runner" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="build" depends="generate-driver">
+ <mkdir dir="bin" />
+ <javac classpath="lib/jython/jython.jar:lib/processing/core.jar"
+ destdir="bin">
+ <src path="src" />
+ <src path="generated" />
+ <exclude name="jycessing/build/**" />
+ </javac>
+ <copy todir="bin">
+ <fileset dir="src" excludes="**/*.java" />
+ </copy>
+ </target>
+
+ <target name="generate-driver"
+ depends="build-driver-generator"
+ description="Generate DriverImpl class">
+ <java classpath="bin:lib/processing/core.jar"
+ classname="jycessing.build.DriverGenerator"
+ fork="true" />
+ </target>
+
+ <target name="build-driver-generator">
+ <mkdir dir="bin" />
+ <javac srcdir="src"
+ includes="jycessing/build/**"
+ classpath="lib/processing/core.jar"
+ destdir="bin" />
+ </target>
+
+ <target name="clean">
+ <delete dir="bin" />
+ <delete file="generated/jycessing/DriverImpl.java" />
+ <mkdir dir="bin" />
+ </target>
+
+ <target name="bumpversion">
+ <propertyfile file="src/jycessing/buildnumber.properties">
+ <entry key="buildnumber"
+ type="int"
+ operation="+"
+ pattern="0000"
+ default="0000" />
+ </propertyfile>
+ </target>
+
</project>
@@ -1,61 +0,0 @@
-"""
- * Band Pass Filter
- * by Damien Di Fede. (Adapted to Python by Jonathan Feinberg)
- *
- * This sketch demonstrates how to use the BandPass effect.
- * Move the mouse left and right to change the frequency of the pass band.
- * Move the mouse up and down to change the band width of the pass band.
-"""
-
-from ddf.minim import Minim, AudioPlayer
-from ddf.minim.effects import BandPass
-
-def setup():
- size(512, 200, P2D)
-
- global minim, groove, bpf
-
- minim = Minim(this)
-
- groove = minim.loadFile("groove.mp3")
- groove.loop()
- # make a band pass filter with a center frequency of 440 Hz and a bandwidth of 20 Hz
- # the third argument is the sample rate of the audio that will be filtered
- # it is required to correctly compute values used by the filter
- bpf = BandPass(440, 20, groove.sampleRate())
- groove.addEffect(bpf)
-
-def draw():
- background(0)
- stroke(255)
- # draw the waveforms
- # the values returned by left.get() and right.get() will be between -1 and 1,
- # so we need to scale them up to see the waveform
- for i in xrange(groove.right.size() - 1):
- x1 = map(i, 0, groove.bufferSize(), 0, width)
- x2 = map(i + 1, 0, groove.bufferSize(), 0, width)
- line(x1, height / 4 - groove.left.get(i) * 50,
- x2, height / 4 - groove.left.get(i + 1) * 50)
- line(x1, 3 * height / 4 - groove.right.get(i) * 50,
- x2, 3 * height / 4 - groove.right.get(i + 1) * 50)
-
- # draw a rectangle to represent the pass band
- noStroke()
- fill(255, 0, 0, 60)
- rect(mouseX - bpf.getBandWidth() / 20, 0, bpf.getBandWidth() / 10, height)
-
-def mouseMoved():
- # map the mouse position to the range [100, 10000], an arbitrary range of passBand frequencies
- passBand = map(mouseX, 0, width, 100, 2000)
- bpf.setFreq(passBand)
- bandWidth = map(mouseY, 0, height, 50, 500)
- bpf.setBandWidth(bandWidth)
- # prints the new values of the coefficients in the console
- bpf.printCoeff()
-
-def stop():
- # always close Minim audio classes when you finish with them
- groove.close()
- # always stop Minim before exiting
- minim.stop()
-
View
@@ -0,0 +1,2 @@
+#!/bin/sh
+java -jar processing-py.jar $1
@@ -0,0 +1 @@
+java -jar processing-py.jar %1
@@ -26,6 +26,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Properties;
import org.python.core.Py;
import org.python.core.PyString;
@@ -148,6 +149,10 @@ public static void main(final String[] args) throws Exception {
// -Dverbose=true for some logging
VERBOSE = Boolean.getBoolean("verbose");
+ final Properties buildnum = new Properties();
+ buildnum.load(Runner.class.getResourceAsStream("buildnumber.properties"));
+ System.err.println("processing.py build " + buildnum.getProperty("buildnumber"));
+
// The last argument is the path to the Python sketch
final String sketchPath = args[args.length - 1];
@@ -0,0 +1,2 @@
+#Wed Aug 18 09:51:41 EDT 2010
+buildnumber=0002

0 comments on commit 22ee420

Please sign in to comment.