Index: plugins/python/src/main/java/hudson/plugins/python/PluginImpl.java =================================================================== --- plugins/python/src/main/java/hudson/plugins/python/PluginImpl.java (revisión: 0) +++ plugins/python/src/main/java/hudson/plugins/python/PluginImpl.java (revisión: 0) @@ -0,0 +1,14 @@ +package hudson.plugins.python; + +import hudson.Plugin; +import hudson.tasks.BuildStep; + +/** + * Entry point for Python plugin + * + */ +public class PluginImpl extends Plugin { + public void start() throws Exception { + BuildStep.BUILDERS.add(Python.DESCRIPTOR); + } +} Index: plugins/python/src/main/java/hudson/plugins/python/Python.java =================================================================== --- plugins/python/src/main/java/hudson/plugins/python/Python.java (revisión: 0) +++ plugins/python/src/main/java/hudson/plugins/python/Python.java (revisión: 0) @@ -0,0 +1,59 @@ +package hudson.plugins.python; + +import hudson.FilePath; +import hudson.model.Descriptor; +import hudson.tasks.Builder; +import hudson.tasks.CommandInterpreter; +import net.sf.json.JSONObject; +import org.kohsuke.stapler.StaplerRequest; + +/** + * Invokes the Python interpreter and invokes the Python script entered on the + * hudson build configuration. + * + * It is expected that the Python interpreter is available on the system PATH. + * + */ +public class Python extends CommandInterpreter { + + private Python(String command) { + super(command); + } + + protected String[] buildCommandLine(FilePath script) { + return new String[]{"python", script.getRemote()}; + } + + protected String getContents() { + return command; + } + + protected String getFileExtension() { + return ".py"; + } + + public Descriptor getDescriptor() { + return DESCRIPTOR; + } + + public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); + + public static final class DescriptorImpl extends Descriptor { + private DescriptorImpl() { + super(Python.class); + } + + public Builder newInstance(StaplerRequest req, JSONObject formData) { + return new Python(formData.getString("python")); + } + + public String getDisplayName() { + return "Execute Python script"; + } + + @Override + public String getHelpFile() { + return "/plugin/python/help.html"; + } + } +} Index: plugins/python/src/main/resources/hudson/plugins/python/Python/config.jelly =================================================================== --- plugins/python/src/main/resources/hudson/plugins/python/Python/config.jelly (revisión: 0) +++ plugins/python/src/main/resources/hudson/plugins/python/Python/config.jelly (revisión: 0) @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file Index: plugins/python/src/main/resources/index.jelly =================================================================== --- plugins/python/src/main/resources/index.jelly (revisión: 0) +++ plugins/python/src/main/resources/index.jelly (revisión: 0) @@ -0,0 +1,8 @@ + +
+ This is Python plugin. The build scripts written in python will be executed by this plugin. +
Index: plugins/python/src/main/webapp/help.html =================================================================== --- plugins/python/src/main/webapp/help.html (revisión: 0) +++ plugins/python/src/main/webapp/help.html (revisión: 0) @@ -0,0 +1,6 @@ +
+

+ Runs a Python script (defaults to python interpreter) for building the project. + The script will be run with the workspace as the current directory. +

+
Index: plugins/python/pom.xml =================================================================== --- plugins/python/pom.xml (revisión: 0) +++ plugins/python/pom.xml (revisión: 0) @@ -0,0 +1,15 @@ + + 4.0.0 + + org.jvnet.hudson.plugins + plugin + 1.310 + ../pom.xml + + + python + hpi + 1.0-SNAPSHOT + Hudson Python Plugin + http://wiki.hudson-ci.org/display/HUDSON/Python+Plugin +