mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-21 00:10:24 +00:00
added
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1691 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
8f0a4d3515
commit
d0d1c5d69f
1 changed files with 73 additions and 0 deletions
73
config/install-linkchecker.py
Normal file
73
config/install-linkchecker.py
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue