mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Conditionalize Tcl feature
This commit is contained in:
parent
e47c381c62
commit
e0f780d581
1 changed files with 57 additions and 35 deletions
|
|
@ -22,6 +22,8 @@ srcdir = os.path.abspath("../..")
|
||||||
# goes into file name and ProductCode. Defaults to
|
# goes into file name and ProductCode. Defaults to
|
||||||
# current_version.day for Snapshot, current_version otherwise
|
# current_version.day for Snapshot, current_version otherwise
|
||||||
full_current_version = None
|
full_current_version = None
|
||||||
|
# Is Tcl available at all?
|
||||||
|
have_tcl = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from config import *
|
from config import *
|
||||||
|
|
@ -762,7 +764,8 @@ def add_features(db):
|
||||||
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)
|
||||||
tcltk = Feature(db, "TclTk", "Tcl/Tk", "Tkinter, IDLE, pydoc", 5,
|
if have_tcl:
|
||||||
|
tcltk = Feature(db, "TclTk", "Tcl/Tk", "Tkinter, IDLE, pydoc", 5,
|
||||||
parent = default_feature, attributes=2)
|
parent = default_feature, attributes=2)
|
||||||
htmlfiles = Feature(db, "Documentation", "Documentation",
|
htmlfiles = Feature(db, "Documentation", "Documentation",
|
||||||
"Python HTMLHelp File", 7, parent = default_feature)
|
"Python HTMLHelp File", 7, parent = default_feature)
|
||||||
|
|
@ -811,7 +814,8 @@ def add_files(db):
|
||||||
# Add all executables, icons, text files into the TARGETDIR component
|
# Add all executables, icons, text files into the TARGETDIR component
|
||||||
root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir")
|
root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir")
|
||||||
default_feature.set_current()
|
default_feature.set_current()
|
||||||
root.add_file("PCBuild/w9xpopen.exe")
|
if not msilib.Win64:
|
||||||
|
root.add_file("PCBuild/w9xpopen.exe")
|
||||||
root.add_file("PC/py.ico")
|
root.add_file("PC/py.ico")
|
||||||
root.add_file("PC/pyc.ico")
|
root.add_file("PC/pyc.ico")
|
||||||
root.add_file("README.txt", src="README")
|
root.add_file("README.txt", src="README")
|
||||||
|
|
@ -851,6 +855,8 @@ def add_files(db):
|
||||||
if dir == "CVS" or dir.startswith("plat-"):
|
if dir == "CVS" or dir.startswith("plat-"):
|
||||||
continue
|
continue
|
||||||
elif dir in ["lib-tk", "idlelib", "Icons"]:
|
elif dir in ["lib-tk", "idlelib", "Icons"]:
|
||||||
|
if not have_tcl:
|
||||||
|
continue
|
||||||
tcltk.set_current()
|
tcltk.set_current()
|
||||||
elif dir in ['test', 'output']:
|
elif dir in ['test', 'output']:
|
||||||
testsuite.set_current()
|
testsuite.set_current()
|
||||||
|
|
@ -913,15 +919,16 @@ def add_files(db):
|
||||||
continue
|
continue
|
||||||
dlls.append(f)
|
dlls.append(f)
|
||||||
lib.add_file(f)
|
lib.add_file(f)
|
||||||
if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"):
|
if have_tcl:
|
||||||
print "WARNING: Missing _tkinter.pyd"
|
if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"):
|
||||||
else:
|
print "WARNING: Missing _tkinter.pyd"
|
||||||
lib.start_component("TkDLLs", tcltk)
|
else:
|
||||||
lib.add_file("_tkinter.pyd")
|
lib.start_component("TkDLLs", tcltk)
|
||||||
dlls.append("_tkinter.pyd")
|
lib.add_file("_tkinter.pyd")
|
||||||
tcldir = os.path.normpath(srcdir+"/../tcltk/bin")
|
dlls.append("_tkinter.pyd")
|
||||||
for f in glob.glob1(tcldir, "*.dll"):
|
tcldir = os.path.normpath(srcdir+"/../tcltk/bin")
|
||||||
lib.add_file(f, src=os.path.join(tcldir, f))
|
for f in glob.glob1(tcldir, "*.dll"):
|
||||||
|
lib.add_file(f, src=os.path.join(tcldir, f))
|
||||||
# check whether there are any unknown extensions
|
# check whether there are any unknown extensions
|
||||||
for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"):
|
for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"):
|
||||||
if f.endswith("_d.pyd"): continue # debug version
|
if f.endswith("_d.pyd"): continue # debug version
|
||||||
|
|
@ -938,19 +945,20 @@ def add_files(db):
|
||||||
for f in dlls:
|
for f in dlls:
|
||||||
lib.add_file(f.replace('pyd','lib'))
|
lib.add_file(f.replace('pyd','lib'))
|
||||||
lib.add_file('python%s%s.lib' % (major, minor))
|
lib.add_file('python%s%s.lib' % (major, minor))
|
||||||
# Add Tcl/Tk
|
if have_tcl:
|
||||||
tcldirs = [(root, '../tcltk/lib', 'tcl')]
|
# Add Tcl/Tk
|
||||||
tcltk.set_current()
|
tcldirs = [(root, '../tcltk/lib', 'tcl')]
|
||||||
while tcldirs:
|
tcltk.set_current()
|
||||||
parent, phys, dir = tcldirs.pop()
|
while tcldirs:
|
||||||
lib = PyDirectory(db, cab, parent, phys, dir, "%s|%s" % (parent.make_short(dir), dir))
|
parent, phys, dir = tcldirs.pop()
|
||||||
if not os.path.exists(lib.absolute):
|
lib = PyDirectory(db, cab, parent, phys, dir, "%s|%s" % (parent.make_short(dir), dir))
|
||||||
continue
|
if not os.path.exists(lib.absolute):
|
||||||
for f in os.listdir(lib.absolute):
|
continue
|
||||||
if os.path.isdir(os.path.join(lib.absolute, f)):
|
for f in os.listdir(lib.absolute):
|
||||||
tcldirs.append((lib, f, f))
|
if os.path.isdir(os.path.join(lib.absolute, f)):
|
||||||
else:
|
tcldirs.append((lib, f, f))
|
||||||
lib.add_file(f)
|
else:
|
||||||
|
lib.add_file(f)
|
||||||
# Add tools
|
# Add tools
|
||||||
tools.set_current()
|
tools.set_current()
|
||||||
tooldir = PyDirectory(db, cab, root, "Tools", "Tools", "TOOLS|Tools")
|
tooldir = PyDirectory(db, cab, root, "Tools", "Tools", "TOOLS|Tools")
|
||||||
|
|
@ -965,8 +973,9 @@ def add_files(db):
|
||||||
x.glob("*.txt")
|
x.glob("*.txt")
|
||||||
if f == 'Scripts':
|
if f == 'Scripts':
|
||||||
lib.add_file("README.txt", src="README")
|
lib.add_file("README.txt", src="README")
|
||||||
lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw")
|
if have_tcl:
|
||||||
lib.add_file("pydocgui.pyw")
|
lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw")
|
||||||
|
lib.add_file("pydocgui.pyw")
|
||||||
# Add documentation
|
# Add documentation
|
||||||
htmlfiles.set_current()
|
htmlfiles.set_current()
|
||||||
lib = PyDirectory(db, cab, root, "Doc", "Doc", "DOC|Doc")
|
lib = PyDirectory(db, cab, root, "Doc", "Doc", "DOC|Doc")
|
||||||
|
|
@ -984,25 +993,32 @@ def add_registry(db):
|
||||||
# IDLE verbs depend on the tcltk feature.
|
# IDLE verbs depend on the tcltk feature.
|
||||||
# msidbComponentAttributesRegistryKeyPath = 4
|
# msidbComponentAttributesRegistryKeyPath = 4
|
||||||
# -1 for Root specifies "dependent on ALLUSERS property"
|
# -1 for Root specifies "dependent on ALLUSERS property"
|
||||||
|
tcldata = []
|
||||||
|
if have_tcl:
|
||||||
|
tcldata = [
|
||||||
|
("REGISTRY.tcl", msilib.gen_uuid(), "TARGETDIR", 4,
|
||||||
|
"&%s <> 2" % ext_feature.id, "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,
|
||||||
"InstallPath"),
|
"InstallPath"),
|
||||||
("REGISTRY.def", msilib.gen_uuid(), "TARGETDIR", 4,
|
("REGISTRY.def", msilib.gen_uuid(), "TARGETDIR", 4,
|
||||||
None, None),
|
None, None)] + tcldata)
|
||||||
("REGISTRY.tcl", msilib.gen_uuid(), "TARGETDIR", 4,
|
|
||||||
"&%s <> 2" % ext_feature.id, "py.IDLE")])
|
|
||||||
# See "FeatureComponents Table".
|
# See "FeatureComponents Table".
|
||||||
# The association between TclTk and pythonw.exe is necessary to make ICE59
|
# The association between TclTk and pythonw.exe is necessary to make ICE59
|
||||||
# happy, because the installer otherwise believes that the IDLE and PyDoc
|
# happy, because the installer otherwise believes that the IDLE and PyDoc
|
||||||
# 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.
|
||||||
|
tcldata = []
|
||||||
|
if have_tcl:
|
||||||
|
tcltkdata = [(tcltk.id, "REGISTRY.tcl"),
|
||||||
|
(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")] +
|
||||||
(tcltk.id, "REGISTRY.tcl"),
|
tcldata
|
||||||
(tcltk.id, "pythonw.exe")])
|
)
|
||||||
|
|
||||||
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"
|
||||||
|
|
@ -1028,7 +1044,8 @@ def add_registry(db):
|
||||||
# Non-advertised verbs: for advertised verbs, we would need to invoke the same
|
# Non-advertised verbs: for advertised verbs, we would need to invoke the same
|
||||||
# executable for both open and "Edit with IDLE". This cannot work, as we want
|
# executable for both open and "Edit with IDLE". This cannot work, as we want
|
||||||
# to use pythonw.exe in either case
|
# to use pythonw.exe in either case
|
||||||
add_data(db, "Registry",
|
if have_tcl:
|
||||||
|
add_data(db, "Registry",
|
||||||
[#Verbs
|
[#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"',
|
||||||
|
|
@ -1058,12 +1075,17 @@ def add_registry(db):
|
||||||
("MenuDir", "ProgramMenuFolder", "PY%s%s|%sPython %s.%s" % (major,minor,testprefix,major,minor))])
|
("MenuDir", "ProgramMenuFolder", "PY%s%s|%sPython %s.%s" % (major,minor,testprefix,major,minor))])
|
||||||
add_data(db, "RemoveFile",
|
add_data(db, "RemoveFile",
|
||||||
[("MenuDir", "TARGETDIR", None, "MenuDir", 2)])
|
[("MenuDir", "TARGETDIR", None, "MenuDir", 2)])
|
||||||
add_data(db, "Shortcut",
|
tcltkshortcuts = []
|
||||||
[# Advertised shortcuts: targets are features, not files
|
if have_tcl:
|
||||||
|
tcltkshortcuts = [
|
||||||
("IDLE", "MenuDir", "IDLE|IDLE (Python GUI)", "pythonw.exe",
|
("IDLE", "MenuDir", "IDLE|IDLE (Python GUI)", "pythonw.exe",
|
||||||
tcltk.id, r"[TARGETDIR]Lib\idlelib\idle.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"),
|
tcltk.id, r"[TARGETDIR]Lib\idlelib\idle.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"),
|
||||||
("PyDoc", "MenuDir", "MODDOCS|Module Docs", "pythonw.exe",
|
("PyDoc", "MenuDir", "MODDOCS|Module Docs", "pythonw.exe",
|
||||||
tcltk.id, r"[TARGETDIR]Tools\scripts\pydocgui.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"),
|
tcltk.id, r"[TARGETDIR]Tools\scripts\pydocgui.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"),
|
||||||
|
]
|
||||||
|
add_data(db, "Shortcut",
|
||||||
|
tcltkshortcuts +
|
||||||
|
[# Advertised shortcuts: targets are features, not files
|
||||||
("Python", "MenuDir", "PYTHON|Python (command line)", "python.exe",
|
("Python", "MenuDir", "PYTHON|Python (command line)", "python.exe",
|
||||||
default_feature.id, None, None, None, "python_icon.exe", 2, None, "TARGETDIR"),
|
default_feature.id, None, None, None, "python_icon.exe", 2, None, "TARGETDIR"),
|
||||||
("Manual", "MenuDir", "MANUAL|Python Manuals", "documentation",
|
("Manual", "MenuDir", "MANUAL|Python Manuals", "documentation",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue