NbPythonHgBuild

Building NetBeans IDE source for Python Development

This build requires JDK 7, and assumes you have installed ant and Mercurial, and both are included on your system's path.
It also requires that you set (or export) ANT_OPTS=-Xmx960m (or thereabouts), and set (or export) JAVA_HOME=[path-to-Java]\jdk1.7.0_79

Obtaining the Sources

Open a terminal (command prompt) window, and navigate to a directory (folder) where you want the code to reside. Note that cloning can take a VERY long time, depending on your network connection. You may want to start it, and go to lunch (or something).

Navigate to the main root directory (just created by the hg clone command), and clone the contrib repository.

hg clone http://hg.netbeans.org/main/contrib

This will create the contrib subdirectory containing the Python sources (and other community-supported projects).

Building

After both clones have completed, you can build the IDE and Python bits:

From the command-line (shell), navigate to the main directory, and execute ant This starts the build for the IDE.

After the IDE build is successful (still in the main directory), execute ant -Dcluster.config=python build to start the build for the Python bits. Note that you may find it useful to redirect the build output to a file like: ant -Dcluster.config=python build >\temp\buildpython.txt or similar. This way you can review the complete output in case something goes awry.

After both builds have succeeded, you can try the result by invoking ant tryme

Debugging

To debug the resulting NetBeans IDE and Python, start NetBeans IDE, and open whichever Python projects you are interested in debugging from \main\contrib
Then, open the project "NetBeans Build System" from \main\nbbuild\build.xml

Expand the node for NetBeans Build System, then expand the node for build.xml
Scroll down to the entries that start with tryme.

tryme simply starts the built IDE (with Python). Fast startup but no debug.

tryme-debug starts the built IDE (with Python) in debug mode, meaning you can set breakpoints in the code and do all the other things the debugger allows.

To invoke one of these, right-click on one of them and click: Run Target

Working with mercurial

Mercurial is the distributed version control software used by Netbeans and the Python NetBeans module.
The starting point to use it is the 'Netbeans Mercurial How-to'

When working daily (or nightly!) in the Netbeans python code you may be faced with urgent simple fixes (ready to commit) mixed with more complex changes that you want keep locally until they reach a stable state. Meanwhile another developer has pushed modifications ready to be merged. This tricky situation may happen often and you'll may find yourself scratching your head when you see the infamous:

$ hg merge
abort: outstanding uncommitted changes

Tor Norbye provided some good Mercurial tips regarding this scenario on his blog.