[New-bugs-announce] [issue21907] Update Windows build batch scripts

Zachary Ware report at bugs.python.org
Wed Jul 2 21:16:42 CEST 2014

New submission from Zachary Ware:

I am aware of a few open issues with the build scripts provided for Windows (both the Tools/buildbot scripts and the .bat files provided in PCbuild), such as #9973 and #9822, and there are some other issues that bother me but that I haven't opened issues for.  Here's a patch which takes care of all of the issues I'm aware of, by almost completely rewriting most of the scripts.

An overview of the changes:

- Tools/buildbot/external*.bat are dead, replaced by PCbuild/get_externals.bat.  Since those scripts have been suggested for use by normal users by PCbuild/readme.txt and the devguide, stubs for Tools/buildbot/external.bat and external-amd64.bat still exist, which display a message suggesting PCbuild/get_externals.bat and then pass all arguments on to that script.

- PCbuild/get_externals.bat is a complete rewrite of Tools/buildbot/external-common.bat, and is written for users rather than buildbots.  It takes '-c/--clean' or '--clean-only' options, which will gently remove^W^W nuke from orbit all existing external library sources.

- PCbuild/build.bat has been updated to set up the environment itself, and to allow arguments to be passed to MSbuild, such as "/m" (though anything containing [ =,] (and possibly other characters) will require quotes to pass through properly, due to batch's wonderful argument handling abilities).  It has also grown an '-e' option, to pull in external libs using get_externals.bat.

- Tools/buildbot/build.bat has been updated to use PCbuild/build.bat, and Tool/buildbot/build-amd64.bat has been updated to use Tools/buildbot/build.bat.

- PCbuild/env.bat has been updated to allow for non-standard VS install locations, but really, it's obsolete with build.bat setting the environment itself.  I would prefer to eliminate PCbuild/build_env.bat and PCbuild/env.bat, but I don't know whether they're an integral part of other people's workflow and don't want to mess that up if they are.  There doesn't seem to be any harm from running the build with the environment set up twice.

- Tools/buildbot/clean.bat has been updated as I suggested in #9973, it has a set list of kill_python exes to try if they exist, then uses `hg purge` to clean *everything* out.  Tools/buildbot/clean-amd64.bat is now just a stub calling Tools/buildbot/clean.bat.

- Tools/buildbot/buildmsi.bat has a few updates, but I can't properly test them (having not yet managed to get an MSI built at all).  The script is currently unused anyway, as far as I know.

- Tools/buildbot/test[-amd64].bat have been updated to use Tools/scripts/run_tests.py, just like the UNIX buildbots.  run_tests.py has been updated to use subprocess.call instead of os.execv on Windows.

- All scripts have been made cwd-agnostic, by which I mean they should run the same way no matter where they are called from.  Also, every effort is made to not pollute the environment (even with VS setup).  They should also be a bit more robust against paths with spaces, but I make no guarantees about that.

- PCbuild/readme.txt has been updated to suggest PCbuild/get_externals.bat instead of Tools/buildbot/external*.bat, and has an added "Quick Start Guide" at the top.  A patch for the devguide will follow.

I think these changes make things simpler, with fewer places to update when options are changed, compilers upgraded, libraries updated, etc.  With this change, the simplest way to build on Windows becomes "PCbuild\build.bat -e" (or add "-d" for debug).  This is still not exactly what I want eventually (see #16895, which is now long out of date :), but is a solid step in that direction.

Most of these changes could be backported to 3.4, and at least a good portion of those to 2.7.  I'm not exactly sure how worth it that would be, though.


assignee: zach.ware
components: Build, Windows
files: better_bats.diff
keywords: buildbot, patch
messages: 222118
nosy: loewis, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Update Windows build batch scripts
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35831/better_bats.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list