Add updated .hgeol file and fix newlines in the 3.1 branch.
diff --git a/Tools/buildbot/build-amd64.bat b/Tools/buildbot/build-amd64.bat
index 8ec3328..5175c62 100644
--- a/Tools/buildbot/build-amd64.bat
+++ b/Tools/buildbot/build-amd64.bat
@@ -1,6 +1,6 @@
-@rem Used by the buildbot "compile" step.

-cmd /c Tools\buildbot\external-amd64.bat

-call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64

-cmd /c Tools\buildbot\clean-amd64.bat

-vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe

-vcbuild PCbuild\pcbuild.sln "Debug|x64"

+@rem Used by the buildbot "compile" step.
+cmd /c Tools\buildbot\external-amd64.bat
+call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
+cmd /c Tools\buildbot\clean-amd64.bat
+vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe
+vcbuild PCbuild\pcbuild.sln "Debug|x64"
diff --git a/Tools/buildbot/build.bat b/Tools/buildbot/build.bat
index 976ce72..ab3ea7d 100644
--- a/Tools/buildbot/build.bat
+++ b/Tools/buildbot/build.bat
@@ -1,7 +1,7 @@
-@rem Used by the buildbot "compile" step.

-cmd /c Tools\buildbot\external.bat

-call "%VS90COMNTOOLS%vsvars32.bat"

-cmd /c Tools\buildbot\clean.bat

-vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe

-vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32"

-

+@rem Used by the buildbot "compile" step.
+cmd /c Tools\buildbot\external.bat
+call "%VS90COMNTOOLS%vsvars32.bat"
+cmd /c Tools\buildbot\clean.bat
+vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe
+vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32"
+
diff --git a/Tools/buildbot/buildmsi.bat b/Tools/buildbot/buildmsi.bat
index 167efd0..4430cb8 100644
--- a/Tools/buildbot/buildmsi.bat
+++ b/Tools/buildbot/buildmsi.bat
@@ -1,21 +1,21 @@
-@rem Used by the buildbot "buildmsi" step.

-

-cmd /c Tools\buildbot\external.bat

-@rem build release versions of things

-call "%VS90COMNTOOLS%vsvars32.bat"

-

-@rem build Python

-vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32"

-

-@rem build the documentation

-bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp'

-"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp

-

-@rem build the MSI file

-cd PC

-nmake /f icons.mak

-cd ..\Tools\msi

-del *.msi

-nmake /f msisupport.mak

-%HOST_PYTHON% msi.py

-

+@rem Used by the buildbot "buildmsi" step.
+
+cmd /c Tools\buildbot\external.bat
+@rem build release versions of things
+call "%VS90COMNTOOLS%vsvars32.bat"
+
+@rem build Python
+vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32"
+
+@rem build the documentation
+bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp'
+"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp
+
+@rem build the MSI file
+cd PC
+nmake /f icons.mak
+cd ..\Tools\msi
+del *.msi
+nmake /f msisupport.mak
+%HOST_PYTHON% msi.py
+
diff --git a/Tools/buildbot/clean-amd64.bat b/Tools/buildbot/clean-amd64.bat
index 1ce1605..9fb35e9 100644
--- a/Tools/buildbot/clean-amd64.bat
+++ b/Tools/buildbot/clean-amd64.bat
@@ -1,7 +1,7 @@
-@rem Used by the buildbot "clean" step.

-call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64

-cd PCbuild

-@echo Deleting .pyc/.pyo files ...

-del /s Lib\*.pyc Lib\*.pyo

-vcbuild /clean pcbuild.sln "Release|x64"

-vcbuild /clean pcbuild.sln "Debug|x64"

+@rem Used by the buildbot "clean" step.
+call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
+cd PCbuild
+@echo Deleting .pyc/.pyo files ...
+del /s Lib\*.pyc Lib\*.pyo
+vcbuild /clean pcbuild.sln "Release|x64"
+vcbuild /clean pcbuild.sln "Debug|x64"
diff --git a/Tools/buildbot/clean.bat b/Tools/buildbot/clean.bat
index 0d4d12e..ec71804 100644
--- a/Tools/buildbot/clean.bat
+++ b/Tools/buildbot/clean.bat
@@ -1,7 +1,7 @@
-@rem Used by the buildbot "clean" step.

-call "%VS90COMNTOOLS%vsvars32.bat"

-@echo Deleting .pyc/.pyo files ...

-del /s Lib\*.pyc Lib\*.pyo

-cd PCbuild

-vcbuild /clean pcbuild.sln "Release|Win32"

-vcbuild /clean pcbuild.sln "Debug|Win32"

+@rem Used by the buildbot "clean" step.
+call "%VS90COMNTOOLS%vsvars32.bat"
+@echo Deleting .pyc/.pyo files ...
+del /s Lib\*.pyc Lib\*.pyo
+cd PCbuild
+vcbuild /clean pcbuild.sln "Release|Win32"
+vcbuild /clean pcbuild.sln "Debug|Win32"
diff --git a/Tools/buildbot/external-amd64.bat b/Tools/buildbot/external-amd64.bat
index 0f46cf9..1cb2ce7 100644
--- a/Tools/buildbot/external-amd64.bat
+++ b/Tools/buildbot/external-amd64.bat
@@ -1,21 +1,21 @@
-@rem Fetches (and builds if necessary) external dependencies

-

-@rem Assume we start inside the Python source directory

-call "Tools\buildbot\external-common.bat"

-call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64

-

-if not exist tcltk64\bin\tcl85g.dll (

-    cd tcl-8.5.2.1\win

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install

-    cd ..\..

-)

-

-if not exist tcltk64\bin\tk85g.dll (

-    cd tk-8.5.2.0\win    

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install

-    cd ..\..

-)

-

+@rem Fetches (and builds if necessary) external dependencies
+
+@rem Assume we start inside the Python source directory
+call "Tools\buildbot\external-common.bat"
+call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
+
+if not exist tcltk64\bin\tcl85g.dll (
+    cd tcl-8.5.2.1\win
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install
+    cd ..\..
+)
+
+if not exist tcltk64\bin\tk85g.dll (
+    cd tk-8.5.2.0\win    
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install
+    cd ..\..
+)
+
diff --git a/Tools/buildbot/external-common.bat b/Tools/buildbot/external-common.bat
index aba7fa9..8beee14 100644
--- a/Tools/buildbot/external-common.bat
+++ b/Tools/buildbot/external-common.bat
@@ -1,43 +1,43 @@
-@rem Common file shared between external.bat and external-amd64.bat.  Responsible for

-@rem fetching external components into the root\.. buildbot directories.

-

-cd ..

-@rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment

-@rem the following, check it in, then check it out, comment it out, then check it back in.

-@rem if exist bzip2-1.0.5 rd /s/q bzip2-1.0.5

-@rem if exist tcltk rd /s/q tcltk

-@rem if exist tcltk64 rd /s/q tcltk64

-@rem if exist tcl8.4.12 rd /s/q tcl8.4.12

-@rem if exist tcl8.4.16 rd /s/q tcl8.4.16

-@rem if exist tcl-8.4.18.1 rd /s/q tcl-8.4.18.1

-@rem if exist tk8.4.12 rd /s/q tk8.4.12

-@rem if exist tk8.4.16 rd /s/q tk8.4.16

-@rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1

-@rem if exist db-4.4.20 rd /s/q db-4.4.20

-@rem if exist openssl-0.9.8l rd /s/q openssl-0.9.8l

-@rem if exist sqlite-3.5.9 rd /s/q sqlite-3.5.9    

-

-@rem bzip

-if not exist bzip2-1.0.5 (

-   rd /s/q bzip2-1.0.3

-  svn export http://svn.python.org/projects/external/bzip2-1.0.5

-)

-

-@rem Sleepycat db

-if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20-vs9 db-4.4.20

-

-@rem OpenSSL

-if not exist openssl-0.9.8l svn export http://svn.python.org/projects/external/openssl-0.9.8l

-

-@rem tcl/tk

-if not exist tcl-8.5.2.1 (

-   rd /s/q tcltk tcltk64

-   svn export http://svn.python.org/projects/external/tcl-8.5.2.1

-)

-if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0

-

-@rem sqlite3

-if not exist sqlite-3.5.9 (

-  rd /s/q sqlite-source-3.3.4

-  svn export http://svn.python.org/projects/external/sqlite-3.5.9

-)

+@rem Common file shared between external.bat and external-amd64.bat.  Responsible for
+@rem fetching external components into the root\.. buildbot directories.
+
+cd ..
+@rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment
+@rem the following, check it in, then check it out, comment it out, then check it back in.
+@rem if exist bzip2-1.0.5 rd /s/q bzip2-1.0.5
+@rem if exist tcltk rd /s/q tcltk
+@rem if exist tcltk64 rd /s/q tcltk64
+@rem if exist tcl8.4.12 rd /s/q tcl8.4.12
+@rem if exist tcl8.4.16 rd /s/q tcl8.4.16
+@rem if exist tcl-8.4.18.1 rd /s/q tcl-8.4.18.1
+@rem if exist tk8.4.12 rd /s/q tk8.4.12
+@rem if exist tk8.4.16 rd /s/q tk8.4.16
+@rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1
+@rem if exist db-4.4.20 rd /s/q db-4.4.20
+@rem if exist openssl-0.9.8l rd /s/q openssl-0.9.8l
+@rem if exist sqlite-3.5.9 rd /s/q sqlite-3.5.9    
+
+@rem bzip
+if not exist bzip2-1.0.5 (
+   rd /s/q bzip2-1.0.3
+  svn export http://svn.python.org/projects/external/bzip2-1.0.5
+)
+
+@rem Sleepycat db
+if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20-vs9 db-4.4.20
+
+@rem OpenSSL
+if not exist openssl-0.9.8l svn export http://svn.python.org/projects/external/openssl-0.9.8l
+
+@rem tcl/tk
+if not exist tcl-8.5.2.1 (
+   rd /s/q tcltk tcltk64
+   svn export http://svn.python.org/projects/external/tcl-8.5.2.1
+)
+if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0
+
+@rem sqlite3
+if not exist sqlite-3.5.9 (
+  rd /s/q sqlite-source-3.3.4
+  svn export http://svn.python.org/projects/external/sqlite-3.5.9
+)
diff --git a/Tools/buildbot/external.bat b/Tools/buildbot/external.bat
index d6b18ae..d90e8ce 100644
--- a/Tools/buildbot/external.bat
+++ b/Tools/buildbot/external.bat
@@ -1,21 +1,21 @@
-@rem Fetches (and builds if necessary) external dependencies

-

-@rem Assume we start inside the Python source directory

-call "Tools\buildbot\external-common.bat"

-call "%VS90COMNTOOLS%\vsvars32.bat"

-

-if not exist tcltk\bin\tcl85g.dll (

-    @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install

-    cd tcl-8.5.2.1\win

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all 

-    nmake -f makefile.vc DEBUG=1 INSTALLDIR=..\..\tcltk install

-    cd ..\..

-)

-

-if not exist tcltk\bin\tk85g.dll (

-    cd tk-8.5.2.0\win    

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all

-    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install

-    cd ..\..

-)

+@rem Fetches (and builds if necessary) external dependencies
+
+@rem Assume we start inside the Python source directory
+call "Tools\buildbot\external-common.bat"
+call "%VS90COMNTOOLS%\vsvars32.bat"
+
+if not exist tcltk\bin\tcl85g.dll (
+    @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install
+    cd tcl-8.5.2.1\win
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all 
+    nmake -f makefile.vc DEBUG=1 INSTALLDIR=..\..\tcltk install
+    cd ..\..
+)
+
+if not exist tcltk\bin\tk85g.dll (
+    cd tk-8.5.2.0\win    
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all
+    nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install
+    cd ..\..
+)
diff --git a/Tools/buildbot/test-amd64.bat b/Tools/buildbot/test-amd64.bat
index 6124b51..d178c92 100644
--- a/Tools/buildbot/test-amd64.bat
+++ b/Tools/buildbot/test-amd64.bat
@@ -1,3 +1,3 @@
-@rem Used by the buildbot "test" step.

-cd PCbuild

-call rt.bat -q -d -x64 -uall -rw

+@rem Used by the buildbot "test" step.
+cd PCbuild
+call rt.bat -q -d -x64 -uall -rw
diff --git a/Tools/buildbot/test.bat b/Tools/buildbot/test.bat
index 7879046..16c07fb 100644
--- a/Tools/buildbot/test.bat
+++ b/Tools/buildbot/test.bat
@@ -1,4 +1,4 @@
-@rem Used by the buildbot "test" step.

-cd PCbuild

-call rt.bat -d -q -uall -rw -n

-

+@rem Used by the buildbot "test" step.
+cd PCbuild
+call rt.bat -d -q -uall -rw -n
+
diff --git a/Tools/msi/merge.py b/Tools/msi/merge.py
index def3964..85de209 100644
--- a/Tools/msi/merge.py
+++ b/Tools/msi/merge.py
@@ -1,84 +1,84 @@
-import msilib,os,win32com,tempfile,sys

-PCBUILD="PCBuild"

-certname = None

-from config import *

-

-Win64 = "amd64" in PCBUILD

-

-mod_dir = os.path.join(os.environ["ProgramFiles"], "Common Files", "Merge Modules")

-msi = None

-if len(sys.argv)==2:

-    msi = sys.argv[1]

-if Win64:

-    modules = ["Microsoft_VC90_CRT_x86_x64.msm", "policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"]

-    if not msi: msi = "python-%s.amd64.msi" % full_current_version

-else:

-    modules = ["Microsoft_VC90_CRT_x86.msm","policy_9_0_Microsoft_VC90_CRT_x86.msm"]

-    if not msi: msi = "python-%s.msi" % full_current_version

-for i, n in enumerate(modules):

-    modules[i] = os.path.join(mod_dir, n)

-

-def merge(msi, feature, rootdir, modules):

-    cab_and_filecount = []

-    # Step 1: Merge databases, extract cabfiles

-    m = msilib.MakeMerge2()

-    m.OpenLog("merge.log")

-    print "Opened Log"

-    m.OpenDatabase(msi)

-    print "Opened DB"

-    for module in modules:

-        print module

-        m.OpenModule(module,0)

-        print "Opened Module",module

-        m.Merge(feature, rootdir)

-        print "Errors:"

-        for e in m.Errors:

-            print e.Type, e.ModuleTable, e.DatabaseTable

-            print "   Modkeys:",

-            for s in e.ModuleKeys: print s,

-            print

-            print "   DBKeys:",

-            for s in e.DatabaseKeys: print s,

-            print

-        cabname = tempfile.mktemp(suffix=".cab")

-        m.ExtractCAB(cabname)

-        cab_and_filecount.append((cabname, len(m.ModuleFiles)))

-        m.CloseModule()

-    m.CloseDatabase(True)

-    m.CloseLog()

-

-    # Step 2: Add CAB files

-    i = msilib.MakeInstaller()

-    db = i.OpenDatabase(msi, win32com.client.constants.msiOpenDatabaseModeTransact)

-

-    v = db.OpenView("SELECT LastSequence FROM Media")

-    v.Execute(None)

-    maxmedia = -1

-    while 1:

-        r = v.Fetch()

-        if not r: break

-        seq = r.IntegerData(1)

-        if seq > maxmedia:

-            maxmedia = seq

-    print "Start of Media", maxmedia

-

-    for cabname, count in cab_and_filecount:

-        stream = "merged%d" % maxmedia

-        msilib.add_data(db, "Media",

-                [(maxmedia+1, maxmedia+count, None, "#"+stream, None, None)])

-        msilib.add_stream(db, stream,  cabname)

-        os.unlink(cabname)

-        maxmedia += count

-    # The merge module sets ALLUSERS to 1 in the property table. 

-    # This is undesired; delete that

-    v = db.OpenView("DELETE FROM Property WHERE Property='ALLUSERS'")

-    v.Execute(None)

-    v.Close()

-    db.Commit()

-

-merge(msi, "SharedCRT", "TARGETDIR", modules)

-

-# certname (from config.py) should be (a substring of)

-# the certificate subject, e.g. "Python Software Foundation"

-if certname:

-    os.system('signtool sign /n "%s" /t http://timestamp.verisign.com/scripts/timestamp.dll %s' % (certname, msi))

+import msilib,os,win32com,tempfile,sys
+PCBUILD="PCBuild"
+certname = None
+from config import *
+
+Win64 = "amd64" in PCBUILD
+
+mod_dir = os.path.join(os.environ["ProgramFiles"], "Common Files", "Merge Modules")
+msi = None
+if len(sys.argv)==2:
+    msi = sys.argv[1]
+if Win64:
+    modules = ["Microsoft_VC90_CRT_x86_x64.msm", "policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"]
+    if not msi: msi = "python-%s.amd64.msi" % full_current_version
+else:
+    modules = ["Microsoft_VC90_CRT_x86.msm","policy_9_0_Microsoft_VC90_CRT_x86.msm"]
+    if not msi: msi = "python-%s.msi" % full_current_version
+for i, n in enumerate(modules):
+    modules[i] = os.path.join(mod_dir, n)
+
+def merge(msi, feature, rootdir, modules):
+    cab_and_filecount = []
+    # Step 1: Merge databases, extract cabfiles
+    m = msilib.MakeMerge2()
+    m.OpenLog("merge.log")
+    print "Opened Log"
+    m.OpenDatabase(msi)
+    print "Opened DB"
+    for module in modules:
+        print module
+        m.OpenModule(module,0)
+        print "Opened Module",module
+        m.Merge(feature, rootdir)
+        print "Errors:"
+        for e in m.Errors:
+            print e.Type, e.ModuleTable, e.DatabaseTable
+            print "   Modkeys:",
+            for s in e.ModuleKeys: print s,
+            print
+            print "   DBKeys:",
+            for s in e.DatabaseKeys: print s,
+            print
+        cabname = tempfile.mktemp(suffix=".cab")
+        m.ExtractCAB(cabname)
+        cab_and_filecount.append((cabname, len(m.ModuleFiles)))
+        m.CloseModule()
+    m.CloseDatabase(True)
+    m.CloseLog()
+
+    # Step 2: Add CAB files
+    i = msilib.MakeInstaller()
+    db = i.OpenDatabase(msi, win32com.client.constants.msiOpenDatabaseModeTransact)
+
+    v = db.OpenView("SELECT LastSequence FROM Media")
+    v.Execute(None)
+    maxmedia = -1
+    while 1:
+        r = v.Fetch()
+        if not r: break
+        seq = r.IntegerData(1)
+        if seq > maxmedia:
+            maxmedia = seq
+    print "Start of Media", maxmedia
+
+    for cabname, count in cab_and_filecount:
+        stream = "merged%d" % maxmedia
+        msilib.add_data(db, "Media",
+                [(maxmedia+1, maxmedia+count, None, "#"+stream, None, None)])
+        msilib.add_stream(db, stream,  cabname)
+        os.unlink(cabname)
+        maxmedia += count
+    # The merge module sets ALLUSERS to 1 in the property table. 
+    # This is undesired; delete that
+    v = db.OpenView("DELETE FROM Property WHERE Property='ALLUSERS'")
+    v.Execute(None)
+    v.Close()
+    db.Commit()
+
+merge(msi, "SharedCRT", "TARGETDIR", modules)
+
+# certname (from config.py) should be (a substring of)
+# the certificate subject, e.g. "Python Software Foundation"
+if certname:
+    os.system('signtool sign /n "%s" /t http://timestamp.verisign.com/scripts/timestamp.dll %s' % (certname, msi))