@@ -383,6 +383,7 @@ def add_ui(db):
383383 ])
384384
385385 compileargs = r'-Wi "[TARGETDIR]Lib\compileall.py" -f -x bad_coding|badsyntax|site-packages|py2_ "[TARGETDIR]Lib"'
386+ lib2to3args = r'-c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"'
386387 # See "CustomAction Table"
387388 add_data (db , "CustomAction" , [
388389 # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty
@@ -396,6 +397,7 @@ def add_ui(db):
396397 # See "Custom Action Type 18"
397398 ("CompilePyc" , 18 , "python.exe" , compileargs ),
398399 ("CompilePyo" , 18 , "python.exe" , "-O " + compileargs ),
400+ ("CompileGrammar" , 18 , "python.exe" , lib2to3args ),
399401 ])
400402
401403 # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
@@ -425,12 +427,14 @@ def add_ui(db):
425427 ("UpdateEditIDLE" , None , 1050 ),
426428 ("CompilePyc" , "COMPILEALL" , 6800 ),
427429 ("CompilePyo" , "COMPILEALL" , 6801 ),
430+ ("CompileGrammar" , "COMPILEALL" , 6802 ),
428431 ])
429432 add_data (db , "AdminExecuteSequence" ,
430433 [("InitialTargetDir" , 'TARGETDIR=""' , 750 ),
431434 ("SetDLLDirToTarget" , 'DLLDIR=""' , 751 ),
432435 ("CompilePyc" , "COMPILEALL" , 6800 ),
433436 ("CompilePyo" , "COMPILEALL" , 6801 ),
437+ ("CompileGrammar" , "COMPILEALL" , 6802 ),
434438 ])
435439
436440 #####################################################################
@@ -841,6 +845,26 @@ def extract_msvcr90():
841845 result .append ((f , kw ))
842846 return result
843847
848+ def generate_license ():
849+ import shutil , glob
850+ out = open ("LICENSE.txt" , "w" )
851+ shutil .copyfileobj (open (os .path .join (srcdir , "LICENSE" )), out )
852+ for dir , file in (("bzip2" ,"LICENSE" ),
853+ ("db" , "LICENSE" ),
854+ ("openssl" , "LICENSE" ),
855+ ("tcl" , "license.terms" ),
856+ ("tk" , "license.terms" )):
857+ out .write ("\n This copy of Python includes a copy of %s, which is licensed under the following terms:\n \n " % dir )
858+ dirs = glob .glob (srcdir + "/../" + dir + "-*" )
859+ if not dirs :
860+ raise ValueError , "Could not find " + srcdir + "/../" + dir + "-*"
861+ if len (dirs ) > 2 :
862+ raise ValueError , "Multiple copies of " + dir
863+ dir = dirs [0 ]
864+ shutil .copyfileobj (open (os .path .join (dir , file )), out )
865+ out .close ()
866+
867+
844868class PyDirectory (Directory ):
845869 """By default, all components in the Python installer
846870 can run from source."""
@@ -861,7 +885,8 @@ def add_files(db):
861885 root .add_file ("%s/w9xpopen.exe" % PCBUILD )
862886 root .add_file ("README.txt" , src = "README" )
863887 root .add_file ("NEWS.txt" , src = "Misc/NEWS" )
864- root .add_file ("LICENSE.txt" , src = "LICENSE" )
888+ generate_license ()
889+ root .add_file ("LICENSE.txt" , src = os .path .abspath ("LICENSE.txt" ))
865890 root .start_component ("python.exe" , keyfile = "python.exe" )
866891 root .add_file ("%s/python.exe" % PCBUILD )
867892 root .start_component ("pythonw.exe" , keyfile = "pythonw.exe" )
@@ -979,6 +1004,8 @@ def add_files(db):
9791004 if dir == "setuptools" :
9801005 lib .add_file ("cli.exe" )
9811006 lib .add_file ("gui.exe" )
1007+ if dir == "lib2to3" :
1008+ lib .removefile ("pickle" , "*.pickle" )
9821009 if dir == "data" and parent .physical == "test" and parent .basedir .physical == "email" :
9831010 # This should contain all non-.svn files listed in subversion
9841011 for f in os .listdir (lib .absolute ):
0 commit comments