@@ -420,6 +420,8 @@ def add_ui(db):
420420
421421 compileargs = r'-Wi "[TARGETDIR]Lib\compileall.py" -f -x "bad_coding|badsyntax|site-packages|py2_|lib2to3\\tests|venv\\scripts" "[TARGETDIR]Lib"'
422422 lib2to3args = r'-c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"'
423+ updatepipargs = r'-m ensurepip -U'
424+ removepipargs = r'-m ensurepip -r' # does not yet work
423425 # See "CustomAction Table"
424426 add_data (db , "CustomAction" , [
425427 # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty
@@ -436,6 +438,9 @@ def add_ui(db):
436438 ("CompilePyc" , 18 , "python.exe" , compileargs ),
437439 ("CompilePyo" , 18 , "python.exe" , "-O " + compileargs ),
438440 ("CompileGrammar" , 18 , "python.exe" , lib2to3args ),
441+ # msidbCustomActionTypeInScript (1024); run during actual installation
442+ ("UpdatePip" , 18 + 1024 , "python.exe" , updatepipargs ),
443+ #("RemovePip", 18, "python.exe", removepipargs),
439444 ])
440445
441446 # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
@@ -462,7 +467,7 @@ def add_ui(db):
462467
463468 # Prepend TARGETDIR to the system path, and remove it on uninstall.
464469 add_data (db , "Environment" ,
465- [("PathAddition" , "=-*Path" , "[TARGETDIR];[~]" , "REGISTRY.path" )])
470+ [("PathAddition" , "=-*Path" , "[TARGETDIR];[TARGETDIR]Scripts;[ ~]" , "REGISTRY.path" )])
466471
467472 # Execute Sequences
468473 add_data (db , "InstallExecuteSequence" ,
@@ -472,6 +477,12 @@ def add_ui(db):
472477 ("SetLauncherDirToWindows" , 'LAUNCHERDIR="" and ' + sys32cond , 753 ),
473478 ("SetLauncherDirToTarget" , 'LAUNCHERDIR="" and not ' + sys32cond , 754 ),
474479 ("UpdateEditIDLE" , None , 1050 ),
480+ # run command if install state of pip changes to INSTALLSTATE_LOCAL
481+ # run after InstallFiles
482+ ("UpdatePip" , "&pip=3" , 4001 ),
483+ # remove pip when state changes to INSTALLSTATE_ABSENT
484+ # run before RemoveFiles
485+ #("RemovePip", "&pip=2", 3499),
475486 ("CompilePyc" , "COMPILEALL" , 6800 ),
476487 ("CompilePyo" , "COMPILEALL" , 6801 ),
477488 ("CompileGrammar" , "COMPILEALL" , 6802 ),
@@ -751,7 +762,8 @@ def add_ui(db):
751762 advanced = PyDialog (db , "AdvancedDlg" , x , y , w , h , modal , title ,
752763 "CompilePyc" , "Ok" , "Ok" )
753764 advanced .title ("Advanced Options for [ProductName]" )
754- # A radio group with two options: allusers, justme
765+
766+ # A checkbox whether to build pyc files
755767 advanced .checkbox ("CompilePyc" , 135 , 60 , 230 , 50 , 3 ,
756768 "COMPILEALL" , "Compile .py files to byte code after installation" , "Ok" )
757769
@@ -848,7 +860,8 @@ def add_features(db):
848860 # (i.e. additional Python libraries) need to follow the parent feature.
849861 # Features that have no advertisement trigger (e.g. the test suite)
850862 # must not support advertisement
851- global default_feature , tcltk , htmlfiles , tools , testsuite , ext_feature , private_crt , prepend_path
863+ global default_feature , tcltk , htmlfiles , tools , testsuite
864+ global ext_feature , private_crt , prepend_path , update_pip
852865 default_feature = Feature (db , "DefaultFeature" , "Python" ,
853866 "Python Interpreter and Libraries" ,
854867 1 , directory = "TARGETDIR" )
@@ -870,16 +883,22 @@ def add_features(db):
870883 tools = Feature (db , "Tools" , "Utility Scripts" ,
871884 "Python utility scripts (Tools/)" , 9 ,
872885 parent = default_feature , attributes = 2 )
886+ # pip installation isn't enabled by default until a clean uninstall procedure
887+ # becomes possible
888+ update_pip = Feature (db , "pip" , "pip" ,
889+ "Install (or upgrade from an earlier version) pip, "
890+ "a tool for installing and managing Python packages." , 11 ,
891+ parent = default_feature , attributes = 2 | 8 , level = 2 )
873892 testsuite = Feature (db , "Testsuite" , "Test suite" ,
874- "Python test suite (Lib/test/)" , 11 ,
893+ "Python test suite (Lib/test/)" , 13 ,
875894 parent = default_feature , attributes = 2 | 8 )
876895 # prepend_path is an additional feature which is to be off by default.
877896 # Since the default level for the above features is 1, this needs to be
878897 # at least level higher.
879898 prepend_path = Feature (db , "PrependPath" , "Add python.exe to Path" ,
880899 "Prepend [TARGETDIR] to the system Path variable. "
881900 "This allows you to type 'python' into a command "
882- "prompt without needing the full path." , 13 ,
901+ "prompt without needing the full path." , 15 ,
883902 parent = default_feature , attributes = 2 | 8 ,
884903 level = 2 )
885904
0 commit comments