1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
"""
__version__ = "$Revision: 1.6 $"
__date__ = "$Date: 2004/04/08 21:07:35 $"
"""
# THIS FILE IS ONLY FOR USE WITH MS WINDOWS
# It is run as parts of the bdist_wininst installer
# Be sure to build the installer with
# 'python setup.py --install-script=install-pythoncard.py'
# or insert this into setup.cfg:
# [bdist_wininst]
# install-script=install-pythoncard.py
import sys, os
from distutils.sysconfig import get_python_lib
if not sys.platform.startswith('win'):
sys.exit()
try:
prg = get_special_folder_path("CSIDL_COMMON_PROGRAMS")
except OSError:
try:
prg = get_special_folder_path("CSIDL_PROGRAMS")
except OSError, reason:
# give up - cannot install shortcuts
print "cannot install shortcuts: %s" % reason
sys.exit()
lib_dir = get_python_lib(plat_specific=1)
dest_dir = os.path.join(prg, "PythonCard")
pythonw = os.path.join(sys.prefix, "pythonw.exe")
if __name__ == '__main__':
if "-install" == sys.argv[1]:
try:
os.mkdir(dest_dir)
directory_created(dest_dir)
except OSError:
pass
# create_shortcut(target, description, filename[, arguments[, \
# workdir[, iconpath[, iconindex]]]])
# file_created(path)
# - register 'path' so that the uninstaller removes it
# directory_created(path)
# - register 'path' so that the uninstaller removes it
# get_special_folder_location(csidl_string)
target = os.path.join(lib_dir,
"PythonCard\\samples\\samples.py")
path = os.path.join(dest_dir, "Sample Launcher.lnk")
create_shortcut(target, "Sample Launcher", path)
file_created(path)
path = os.path.join(dest_dir, "Resource Editor.lnk")
arguments = os.path.join(lib_dir,
"PythonCard\\tools\\resourceEditor\\resourceEditor.py")
create_shortcut(pythonw, "Resource Editor", path, arguments)
file_created(path)
path = os.path.join(dest_dir, "Code Editor.lnk")
arguments = os.path.join(lib_dir,
"PythonCard\\tools\\codeEditor\\codeEditor.py")
create_shortcut(pythonw, "Code Editor", path, arguments)
file_created(path)
path = os.path.join(dest_dir, "Find Files.lnk")
arguments = os.path.join(lib_dir,
"PythonCard\\tools\\findfiles\\findfiles.py")
create_shortcut(pythonw, "Find Files", path, arguments)
file_created(path)
target = os.path.join(lib_dir,
"PythonCard\\docs\\html\\index.html")
path = os.path.join(dest_dir, "Documentation.lnk")
create_shortcut(target, "Documentation", path)
file_created(path)
target = os.path.join(sys.prefix, "RemovePythonCard.exe")
path = os.path.join(dest_dir, "Uninstall PythonCard.lnk")
arguments = "-u " + os.path.join(sys.prefix,
"PythonCard-wininst.log")
create_shortcut(target, "Uninstall PythonCard",
path, arguments)
file_created(path)
print "See the shortcuts installed in the PythonCard Programs Group"
elif "-remove" == sys.argv[1]:
pass
|