Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae77584

Browse files
committed
Fix #3561. Add an option to place the Python installation into the Windows Path environment variable.
1 parent f99983d commit ae77584

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ Tests
189189
Tools / Demos
190190
-------------
191191

192+
- Issue #3561: The Windows installer now has an option, off by default, for
193+
placing the Python installation into the system "Path" environment variable.
194+
192195
- Issue #13165: stringbench is now available in the Tools/stringbench folder.
193196
It used to live in its own SVN project.
194197

Tools/msi/msi.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ def add_ui(db):
454454
("SetDLLDirToTarget", 'DLLDIR=""', 751),
455455
])
456456

457+
# Prepend TARGETDIR to the system path, and remove it on uninstall.
458+
add_data(db, "Environment",
459+
[("PathAddition", "=-*Path", "[TARGETDIR];[~]", "REGISTRY.path")])
460+
457461
# Execute Sequences
458462
add_data(db, "InstallExecuteSequence",
459463
[("InitialTargetDir", 'TARGETDIR=""', 750),
@@ -677,11 +681,11 @@ def add_ui(db):
677681
c=features.xbutton("Advanced", "Advanced", None, 0.30)
678682
c.event("SpawnDialog", "AdvancedDlg")
679683

680-
c=features.text("ItemDescription", 140, 180, 210, 30, 3,
684+
c=features.text("ItemDescription", 140, 180, 210, 40, 3,
681685
"Multiline description of the currently selected item.")
682686
c.mapping("SelectionDescription","Text")
683687

684-
c=features.text("ItemSize", 140, 210, 210, 45, 3,
688+
c=features.text("ItemSize", 140, 225, 210, 33, 3,
685689
"The size of the currently selected item.")
686690
c.mapping("SelectionSize", "Text")
687691

@@ -835,7 +839,7 @@ def add_features(db):
835839
# (i.e. additional Python libraries) need to follow the parent feature.
836840
# Features that have no advertisement trigger (e.g. the test suite)
837841
# must not support advertisement
838-
global default_feature, tcltk, htmlfiles, tools, testsuite, ext_feature, private_crt
842+
global default_feature, tcltk, htmlfiles, tools, testsuite, ext_feature, private_crt, prepend_path
839843
default_feature = Feature(db, "DefaultFeature", "Python",
840844
"Python Interpreter and Libraries",
841845
1, directory = "TARGETDIR")
@@ -860,6 +864,15 @@ def add_features(db):
860864
testsuite = Feature(db, "Testsuite", "Test suite",
861865
"Python test suite (Lib/test/)", 11,
862866
parent = default_feature, attributes=2|8)
867+
# prepend_path is an additional feature which is to be off by default.
868+
# Since the default level for the above features is 1, this needs to be
869+
# at least level higher.
870+
prepend_path = Feature(db, "PrependPath", "Add python.exe to Path",
871+
"Prepend [TARGETDIR] to the system Path variable. "
872+
"This allows you to type 'python' into a command "
873+
"prompt without needing the full path.", 13,
874+
parent = default_feature, attributes=2|8,
875+
level=2)
863876

864877
def extract_msvcr90():
865878
# Find the redistributable files
@@ -1146,6 +1159,8 @@ def add_registry(db):
11461159
"InstallPath"),
11471160
("REGISTRY.doc", msilib.gen_uuid(), "TARGETDIR", registry_component, None,
11481161
"Documentation"),
1162+
("REGISTRY.path", msilib.gen_uuid(), "TARGETDIR", registry_component, None,
1163+
None),
11491164
("REGISTRY.def", msilib.gen_uuid(), "TARGETDIR", registry_component,
11501165
None, None)] + tcldata)
11511166
# See "FeatureComponents Table".
@@ -1162,6 +1177,7 @@ def add_registry(db):
11621177
add_data(db, "FeatureComponents",
11631178
[(default_feature.id, "REGISTRY"),
11641179
(htmlfiles.id, "REGISTRY.doc"),
1180+
(prepend_path.id, "REGISTRY.path"),
11651181
(ext_feature.id, "REGISTRY.def")] +
11661182
tcldata
11671183
)

0 commit comments

Comments
 (0)