Using Python to automate builds

Kosta kosta.koeman at
Wed Aug 5 17:39:15 CEST 2009

On Aug 5, 7:29 am, Hendrik van Rooyen <hend... at> wrote:
> On Wednesday 05 August 2009 14:08:18 David Cournapeau wrote:
> > On Wed, Aug 5, 2009 at 4:56 PM, Hendrik van
> > Rooyen<hend... at> wrote:
> > > On Tuesday 04 August 2009 21:13:10 Kosta wrote:
> > >> I am a Python newbie, tasked with automating (researching) building
> > >> Windows drivers using the WDK build environment.  I've been looking
> > >> into Python for this (instead of writing a bunch of batch files).
> > > Why do you not use make and a makefile - it was designed to
> > > do exactly this.
> > Because make is a pain on windows (lack of a proper shell) ?
> Well, you could always use Dosbox - I am doing exactly that
> on Linux to be able to run some old DOS based assembler
> tools.  It will run on windows too, they claim.
> And it is very simple to use too - no fancy fidgeting, all you have
> to do is to point it at a directory that becomes your "C" drive.
> Bit slow - but hey, nobody's perfect.
> - Hendrik

Sorry for not being more clear.  The WDK provides build.exe, a utility
that calls the compiler & linker with the approprite switches.  In
essence, it manages all the nmake details away from the developer.
For some, this is a bad thing in terms of loss of control.  But in
reality, this is a great thing, as this is the way Microsoft builds
Windows.  As far as I can tell, the WDK build environment is dervied
from the Microsoft Windows build environment, which is great for
developing kernel components in the similar enviornment in which
Microsoft builds its OS.  It is a requirement to use the WDK.

Setenv.bat sets up the path and other environment variables build.exe
needs to compile and link (and even binplace) its utilities.  So
building itself is not the issue.  The problem is that if I call
setenv.bat from Python and then build.exe, but the modifications to
the path (and other environment settings) are not seen by Python, so
the attempt to build without a specified path fails.

Now I can open up a build window that targets a build type (check or
release), an architecture target (x86 or x64) and an OS target (which
will be Windows Xp except if in the future, the driver(s) uses some
infrastructure introduced in later versions of WDM.

However, what I was hoping to do was to have a python script that
would allow me to build 4 versions of the driver: x86 check, x86
release, x64 check, and x64 release.  I may have to resort to using
batch files, but I was hoping as much as possible to use Python.


More information about the Python-list mailing list