Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c3bfc2

Browse files
author
Thomas Heller
committed
Raw documentation for the bdist_wininst postinstallation script.
People are already using it, so these docs are certainly better than no docs at all. Markup is mostly missing and the layout is probably ugly, but this can be fixed later. Question: there are references to MS docs for the CSIDL_... constants and the IShellLink interface. Are these pointers sufficient, or should the MS docs reworded and repeated here?
1 parent e4a070a commit 2c3bfc2

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

Doc/dist/dist.tex

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,84 @@ \subsection{Creating Windows Installers}
13151315
--- normally \file{dist/}, but customizable with the
13161316
\longprogramopt{dist-dir} option.
13171317

1318+
\subsubsection{The Postinstallation script}
1319+
\label{postinstallation-script}
1320+
1321+
Starting with Python 2.3, a postinstallation script can be specified
1322+
which the \longprogramopt{install-script} option. The basename of the
1323+
script must be specified, and the script filename must also be listed
1324+
in the scripts argument to the setup function.
1325+
1326+
This script will be run at installation time on the target system
1327+
after all the files have been copied, with argv[1] set to '-install',
1328+
and again at uninstallation time before the files are removed with argv[1]
1329+
set to '-remove'.
1330+
1331+
The installation script runs embedded in the windows installer, every
1332+
output (sys.stdout, sys.stderr) is redirected into a buffer and will
1333+
be displayed in the GUI after the script has finished.
1334+
1335+
Some functions especially useful in this context are available in the
1336+
installation script.
1337+
1338+
\begin{verbatim}
1339+
dir_created(pathname)
1340+
file_created(pathname)
1341+
\end{verbatim}
1342+
1343+
These functions should be called when a directory or file is created
1344+
by the postinstall script at installation time. It will register the
1345+
pathname with the uninstaller, so that it will be removed when the
1346+
distribution is uninstalled. To be safe, directories are only removed
1347+
if they are empty.
1348+
1349+
\begin{verbatim}
1350+
get_special_folder_path(csidl_string)
1351+
\end{verbatim}
1352+
1353+
This function can be used to retrieve special folder locations on
1354+
Windows like the Start Menu or the Desktop. It returns the full path
1355+
to the folder. 'csidl_string' must be on of the following strings:
1356+
1357+
\begin{verbatim}
1358+
"CSIDL_APPDATA"
1359+
1360+
"CSIDL_COMMON_STARTMENU"
1361+
"CSIDL_STARTMENU"
1362+
1363+
"CSIDL_COMMON_DESKTOPDIRECTORY"
1364+
"CSIDL_DESKTOPDIRECTORY"
1365+
1366+
"CSIDL_COMMON_STARTUP"
1367+
"CSIDL_STARTUP"
1368+
1369+
"CSIDL_COMMON_PROGRAMS"
1370+
"CSIDL_PROGRAMS"
1371+
1372+
"CSIDL_FONTS"
1373+
\end{verbatim}
1374+
1375+
If the folder cannot be retrieved, OSError is raised.
1376+
1377+
Which folders are available depends on the exact Windows version, and probably
1378+
also the configuration. For details refer to Microsoft's documentation of the
1379+
SHGetSpecialFolderPath function.
1380+
1381+
\begin{verbatim}
1382+
create_shortcut(target, description, filename[, arguments[,
1383+
workdir[, iconpath[, iconindex]]]])
1384+
\end{verbatim}
1385+
1386+
This function creates a shortcut.
1387+
target is the path to the program to be started by the shortcut.
1388+
description is displayed in a popup window when the
1389+
filename is the title of the shortcut that the user will see.
1390+
arguments specifies the command line arguments, if any.
1391+
workdir is the working directory for the program.
1392+
iconpath is the file containing the icon for the shortcut,
1393+
and iconindex is the iconindex in the file.
1394+
Again, for details consult the Microsoft documentation for the IShellLink
1395+
interface.
13181396

13191397
\section{Examples}
13201398
\label{examples}

0 commit comments

Comments
 (0)