Using Python to automate builds

Tim Roberts timr at probo.com
Mon Aug 10 01:31:27 EDT 2009


Kosta <kosta.koeman at gmail.com> wrote:
>
>
>What I would like to do, is to open a cmd window, and start a Python
>script.  This script would then (based upon input arguments), build
>different flavors of the driver (fre, chk, x86, x64) and do some post
>processing (create cat files, sign, etc.).
>
>I was hoping to take advantage as much as possible of exisiting
>infrastructure from the WDK.  I am able to call setenv.bat and provide
>all the input parameters.  One of the things setenv.bat does is change
>the path environment variable.  However, this is not captured by
>Python.  I could duplicate the functionality, but I'd rather not.  Is
>there a way to capture all enviroment variable changes being made by a
>batch file from Python?

My suggestion is that you just call "setenv" again every time you start a
new process.  My "build everything" batch file has a series of sections
something like this:

  setlocal
  set LAST=%CD%
  call %DDK%\bin\setenv %DDK% chk WXP no_oacr
  @echo on
  set USERNAME=timr
  cd %LAST%
  build %BLD%
  endlocal

  setlocal
  set LAST=%CD%
  call %DDK%\bin\setenv %DDK% fre WXP no_oacr
  @echo on
  set USERNAME=timr
  cd %LAST%
  build %BLD%
  endlocal

  setlocal
  set LAST=%CD%
  call %DDK%\bin\setenv %DDK% chk WLH x64 no_oacr
  @echo on
  set USERNAME=timr
  cd %LAST%
  build %BLD%
  endlocal
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list