From d0d1c5d69f9ff4690287c19e7a6bef5a61df325f Mon Sep 17 00:00:00 2001 From: calvin Date: Thu, 2 Sep 2004 22:10:32 +0000 Subject: [PATCH] added git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1691 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- config/install-linkchecker.py | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 config/install-linkchecker.py diff --git a/config/install-linkchecker.py b/config/install-linkchecker.py new file mode 100644 index 00000000..8e5e760c --- /dev/null +++ b/config/install-linkchecker.py @@ -0,0 +1,73 @@ +# -*- coding: iso-8859-1 -*- +# snatched from pythoncard CVS + +# 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-linkchecker.py' +# or insert this into setup.cfg: +# [bdist_wininst] +# install-script=install-linkchecker.py + +import sys +import 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, "LinkChecker") +pythonw = os.path.join(sys.prefix, "pythonw.exe") + +def do_install (): + """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) + """ + try: + os.mkdir(dest_dir) + directory_created(dest_dir) + except OSError: + pass + path = os.path.join(dest_dir, "Check URL.lnk") + arguments = os.path.join(script_dir, "linkchecker") + create_shortcut(pythonw, "Check URL", 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, "RemoveLinkChecker.exe") + path = os.path.join(dest_dir, "Uninstall LinkChecker.lnk") + arguments = "-u " + os.path.join(sys.prefix, "LinkChecker-wininst.log") + create_shortcut(target, "Uninstall LinkChecker", path, arguments) + file_created(path) + print "See the shortcuts installed in the LinkChecker Programs Group" + + +if __name__ == '__main__': + if "-install" == sys.argv[1]: + do_install() + elif "-remove" == sys.argv[1]: + pass