A Bash Completion Script for SCons

The Problem

SCons is a build tool that uses Python as the underlying scripting language. Tools like SCons, Rake, Rant (Rake and Rant use Ruby as the underlying scripting language) and Gant (a system that uses Groovy and the Ant tasks) show that using scripting / dynamic languages to create domain specific languages (DSLs) is the way forward for build technology. Systems such as Make, which were revolutions in their time have been superceded by the systems that they inspired. A natural evolution.

I have been using SCons as the build tool for a C++ project and also a LaTeX book. It works very well for both of these having direct support for building C++ programs and LaTeX programs on a very wide variety of operating systems -- I use Ubuntu.

I have, however, had a real irritation: SCons had no support for Bash completion. I use Rake as the build tool for a couple of other things and its support for Bash completion is just so useful and supportive.

The Solution

The solution is totally clear: create a Bash completion script for SCons (also for Gant but that is another story). After looking at the scripts for Rake and Subversion and some experimentation with SCons, I came up with a script (that you can download by clicking here) that seems to do the job. It almost certainly has errors and/or bugs but for the moment it ‘works for me’.

To use this script you can do one of:

The last has the advantage of working for all users of the machine but does require super-user privileges. I use the first as being the easiest.

Do email me if you have any feedback.