Commit dff68d0c authored by Martin v. Löwis's avatar Martin v. Löwis

Change all extensions to unadvertised.

Add script dealing with REGISTRY.tcl installation
parent 23c48a12
...@@ -291,6 +291,10 @@ def add_ui(db): ...@@ -291,6 +291,10 @@ def add_ui(db):
[("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))])
# Scripts # Scripts
# CheckDir sets TargetExists if TARGETDIR exists.
# UpdateEditIDLE sets the REGISTRY.tcl component into
# the installed/uninstalled state according to both the
# Extensions and TclTk features.
open("inst.vbs","w").write(""" open("inst.vbs","w").write("""
Function CheckDir() Function CheckDir()
Set FSO = CreateObject("Scripting.FileSystemObject") Set FSO = CreateObject("Scripting.FileSystemObject")
...@@ -300,10 +304,34 @@ def add_ui(db): ...@@ -300,10 +304,34 @@ def add_ui(db):
Session.Property("TargetExists") = "0" Session.Property("TargetExists") = "0"
end if end if
End Function End Function
Function UpdateEditIDLE()
Dim ext_new, tcl_new, regtcl_old
ext_new = Session.FeatureRequestState("Extensions")
tcl_new = Session.FeatureRequestState("TclTk")
if ext_new=-1 then
ext_new = Session.FeatureCurrentState("Extensions")
end if
if tcl_new=-1 then
tcl_new = Session.FeatureCurrentState("TclTk")
end if
regtcl_old = Session.ComponentCurrentState("REGISTRY.tcl")
if ext_new=3 and (tcl_new=3 or tcl_new=4) and regtcl_old<>3 then
Session.ComponentRequestState("REGISTRY.tcl")=3
end if
if (ext_new=2 or tcl_new=2) and regtcl_old<>2 then
Session.ComponentRequestState("REGISTRY.tcl")=2
end if
End Function
""") """)
# To add debug messages into scripts, the following fragment can be used
# set objRec = Session.Installer.CreateRecord(1)
# objRec.StringData(1) = "Debug message"
# Session.message &H04000000, objRec
add_data(db, "Binary", [("Script", msilib.Binary("inst.vbs"))]) add_data(db, "Binary", [("Script", msilib.Binary("inst.vbs"))])
# See "Custom Action Type 6" # See "Custom Action Type 6"
add_data(db, "CustomAction", [("CheckDir", 6, "Script", "CheckDir")]) add_data(db, "CustomAction",
[("CheckDir", 6, "Script", "CheckDir"),
("UpdateEditIDLE", 6, "Script", "UpdateEditIDLE")])
os.unlink("inst.vbs") os.unlink("inst.vbs")
...@@ -363,6 +391,7 @@ def add_ui(db): ...@@ -363,6 +391,7 @@ def add_ui(db):
[("InitialTargetDir", 'TARGETDIR=""', 750), [("InitialTargetDir", 'TARGETDIR=""', 750),
("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751),
("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752),
("UpdateEditIDLE", None, 1050),
("CompilePyc", "COMPILEALL", 6800), ("CompilePyc", "COMPILEALL", 6800),
("CompilePyo", "COMPILEALL", 6801), ("CompilePyo", "COMPILEALL", 6801),
]) ])
...@@ -738,19 +767,10 @@ def add_features(db): ...@@ -738,19 +767,10 @@ def add_features(db):
default_feature = Feature(db, "DefaultFeature", "Python", default_feature = Feature(db, "DefaultFeature", "Python",
"Python Interpreter and Libraries", "Python Interpreter and Libraries",
1, directory = "TARGETDIR") 1, directory = "TARGETDIR")
# The extensions feature is tricky wrt. advertisement and follow parent. # We don't support advertisement of extensions
# The following combinations must be supported:
# default feature extensions effect on extensions
# locally/from source locally/from source registered
# advertised advertised/locally/from source advertised
# locally/from source not installed not installed
# advertised not installed not advertised
# (only shortcuts are)
# The following combination might be considered meaningless, but cannot be excluded
# locally/from source advertised registered
ext_feature = Feature(db, "Extensions", "Register Extensions", ext_feature = Feature(db, "Extensions", "Register Extensions",
"Make this Python installation the default Python installation", 3, "Make this Python installation the default Python installation", 3,
parent = default_feature) parent = default_feature, attributes=2|8)
if have_tcl: if have_tcl:
tcltk = Feature(db, "TclTk", "Tcl/Tk", "Tkinter, IDLE, pydoc", 5, tcltk = Feature(db, "TclTk", "Tcl/Tk", "Tkinter, IDLE, pydoc", 5,
parent = default_feature, attributes=2) parent = default_feature, attributes=2)
...@@ -763,7 +783,6 @@ def add_features(db): ...@@ -763,7 +783,6 @@ def add_features(db):
"Python test suite (Lib/test/)", 11, "Python test suite (Lib/test/)", 11,
parent = default_feature, attributes=2|8) parent = default_feature, attributes=2|8)
def extract_msvcr71(): def extract_msvcr71():
import _winreg import _winreg
# Find the location of the merge modules # Find the location of the merge modules
...@@ -988,9 +1007,8 @@ def add_registry(db): ...@@ -988,9 +1007,8 @@ def add_registry(db):
tcldata = [] tcldata = []
if have_tcl: if have_tcl:
tcldata = [ tcldata = [
("REGISTRY.tcl", msilib.gen_uuid(), "TARGETDIR", 4, ("REGISTRY.tcl", msilib.gen_uuid(), "TARGETDIR", 4, None,
"&%s <> 2" % ext_feature.id, "py.IDLE")]
"py.IDLE")]
add_data(db, "Component", add_data(db, "Component",
# msidbComponentAttributesRegistryKeyPath = 4 # msidbComponentAttributesRegistryKeyPath = 4
[("REGISTRY", msilib.gen_uuid(), "TARGETDIR", 4, None, [("REGISTRY", msilib.gen_uuid(), "TARGETDIR", 4, None,
...@@ -1003,49 +1021,65 @@ def add_registry(db): ...@@ -1003,49 +1021,65 @@ def add_registry(db):
# shortcuts might get installed without pythonw.exe being install. This # shortcuts might get installed without pythonw.exe being install. This
# is not true, since installing TclTk will install the default feature, which # is not true, since installing TclTk will install the default feature, which
# will cause pythonw.exe to be installed. # will cause pythonw.exe to be installed.
# REGISTRY.tcl is not associated with any feature, as it will be requested
# through a custom action
tcldata = [] tcldata = []
if have_tcl: if have_tcl:
tcldata = [(tcltk.id, "REGISTRY.tcl"), tcldata = [(tcltk.id, "pythonw.exe")]
(tcltk.id, "pythonw.exe")]
add_data(db, "FeatureComponents", add_data(db, "FeatureComponents",
[(default_feature.id, "REGISTRY"), [(default_feature.id, "REGISTRY"),
(ext_feature.id, "REGISTRY.def")] + (ext_feature.id, "REGISTRY.def")] +
tcldata tcldata
) )
# Extensions are not advertised. For advertised extensions,
# we would need separate binaries that install along with the
# extension.
pat = r"Software\Classes\%sPython.%sFile\shell\%s\command" pat = r"Software\Classes\%sPython.%sFile\shell\%s\command"
ewi = "Edit with IDLE" ewi = "Edit with IDLE"
pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon" pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon"
pat3 = r"Software\Classes\%sPython.%sFile" pat3 = r"Software\Classes\%sPython.%sFile"
# Advertised extensions add_data(db, "Registry",
add_data(db, "Extension", [# Extensions
[("py", "extpy.exe", "Python.File", None, ext_feature.id), ("py.ext", -1, r"Software\Classes\."+ext, "",
("pyw", "extpyw.exe", "Python.NoConFile", None, ext_feature.id), "Python.File", "REGISTRY.def"),
("pyc", "extpy.exe", "Python.CompiledFile", None, ext_feature.id), ("pyw.ext", -1, r"Software\Classes\."+ext+'w', "",
("pyo", "extpy.exe", "Python.CompiledFile", None, ext_feature.id)]) "Python.NoConFile", "REGISTRY.def"),
# add_data(db, "MIME") XXX ("pyc.ext", -1, r"Software\Classes\."+ext+'c', "",
add_data(db, "Verb", "Python.CompiledFile", "REGISTRY.def"),
[("py", "open", 1, None, r'"%1"'), ("pyo.ext", -1, r"Software\Classes\."+ext+'o', "",
("pyw", "open", 1, None, r'"%1"'), "Python.CompiledFile", "REGISTRY.def"),
("pyc", "open", 1, None, r'"%1"'), # MIME types
("pyo", "open", 1, None, r'"%1"')]) ("py.mime", -1, r"Software\Classes\."+ext, "Content Type",
add_data(db, "ProgId", "text/plain", "REGISTRY.def"),
[("Python.File", None, None, "Python File", "python_icon.exe", 0), ("pyw.mime", -1, r"Software\Classes\."+ext+'w', "Content Type",
("Python.NoConFile", None, None, "Python File (no console)", "python_icon.exe", 0), "text/plain", "REGISTRY.def"),
("Python.CompiledFile", None, None, "Compiled Python File", "python_icon.exe", 1)]) #Verbs
("py.open", -1, pat % (testprefix, "", "open"), "",
# Non-advertised verbs: for advertised verbs, we would need to invoke the same r'"[TARGETDIR]python.exe" "%1" %*', "REGISTRY.def"),
# executable for both open and "Edit with IDLE". This cannot work, as we want ("pyw.open", -1, pat % (testprefix, "NoCon", "open"), "",
# to use pythonw.exe in either case r'"[TARGETDIR]pythonw.exe" "%1" %*', "REGISTRY.def"),
if have_tcl: ("pyc.open", -1, pat % (testprefix, "Compiled", "open"), "",
add_data(db, "Registry", r'"[TARGETDIR]python.exe" "%1" %*', "REGISTRY.def"),
[#Verbs
("py.IDLE", -1, pat % (testprefix, "", ewi), "", ("py.IDLE", -1, pat % (testprefix, "", ewi), "",
r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"', r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"',
"REGISTRY.tcl"), "REGISTRY.tcl"),
("pyw.IDLE", -1, pat % (testprefix, "NoCon", ewi), "", ("pyw.IDLE", -1, pat % (testprefix, "NoCon", ewi), "",
r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"', r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"',
"REGISTRY.tcl"), "REGISTRY.tcl"),
#Icons
("py.icon", -1, pat2 % (testprefix, ""), "",
r'[TARGETDIR]py.ico', "REGISTRY.def"),
("pyw.icon", -1, pat2 % (testprefix, "NoCon"), "",
r'[TARGETDIR]py.ico', "REGISTRY.def"),
("pyc.icon", -1, pat2 % (testprefix, "Compiled"), "",
r'[TARGETDIR]pyc.ico', "REGISTRY.def"),
# Descriptions
("py.txt", -1, pat3 % (testprefix, ""), "",
"Python File", "REGISTRY.def"),
("pyw.txt", -1, pat3 % (testprefix, "NoCon"), "",
"Python File (no console)", "REGISTRY.def"),
("pyc.txt", -1, pat3 % (testprefix, "Compiled"), "",
"Compiled Python File", "REGISTRY.def"),
]) ])
# Registry keys # Registry keys
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment