[Python-checkins] CVS: distutils/misc archive.h,1.3,1.4 extract.c,1.4,1.5 install.c,1.8,1.9 install.rc,1.4,1.5 resource.h,1.4,1.5 wininst.exe,1.6,1.7
Thomas Heller
theller@users.sourceforge.net
Mon, 19 Feb 2001 01:19:10 -0800
Update of /cvsroot/python/distutils/misc
In directory usw-pr-cvs1:/tmp/cvs-serv9804
Modified Files:
archive.h extract.c install.c install.rc resource.h
wininst.exe
Log Message:
Enhancements to the bdist_wininst command:
--bitmap command line option allows to use a different bitmap file instead
of the build-in python powered logo.
--title lets you specify the text to display on the background.
The editbox in the first screen now longer is
selected (highlighted), it had the WS_TABSTOP flag.
This is the patch
http://sourceforge.net/patch/?func=detailpatch&patch_id=103687&group_id=5470
with two changes:
1. No messagebox displayed when the compilation to .pyc or .pyo files
failes, this will only confuse the user (and it will fail under certain
cases, where sys.path contains garbage).
2. A debugging print statement was removed from bdist_wininst.py.
Index: archive.h
===================================================================
RCS file: /cvsroot/python/distutils/misc/archive.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** archive.h 2000/10/12 19:25:58 1.3
--- archive.h 2001/02/19 09:19:07 1.4
***************
*** 54,57 ****
--- 54,58 ----
int tag;
int uncomp_size;
+ int bitmap_size;
};
Index: extract.c
===================================================================
RCS file: /cvsroot/python/distutils/misc/extract.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** extract.c 2000/10/12 19:25:58 1.4
--- extract.c 2001/02/19 09:19:07 1.5
***************
*** 29,32 ****
--- 29,34 ----
if (!CreateDirectory (pathname, NULL) && notify)
notify (SYSTEM_ERROR, "CreateDirectory (%s)", pathname);
+ else
+ notify (DIR_CREATED, pathname);
}
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
Index: install.c
===================================================================
RCS file: /cvsroot/python/distutils/misc/install.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** install.c 2000/10/12 19:25:58 1.8
--- install.c 2001/02/19 09:19:07 1.9
***************
*** 69,72 ****
--- 69,74 ----
/* Bah: global variables */
+ char modulename[MAX_PATH];
+
HWND hwndMain;
HWND hDialog;
***************
*** 89,92 ****
--- 91,98 ----
BOOL success; /* Installation successfull? */
+ HANDLE hBitmap;
+ char *bitmap_bytes;
+
+
#define WM_NUMFILES WM_USER+1
/* wParam: 0, lParam: total number of files */
***************
*** 97,100 ****
--- 103,108 ----
enum { UNSPECIFIED, ASK, ALWAYS, NEVER } allow_overwrite = UNSPECIFIED;
+ static BOOL notify (int code, char *fmt, ...);
+
static void unescape (char *str)
{
***************
*** 141,145 ****
}
! static int do_compile_files (int (__cdecl * PyRun_SimpleString)(char *))
{
struct tagFile *p;
--- 149,154 ----
}
! static int do_compile_files (int (__cdecl * PyRun_SimpleString)(char *),
! int optimize)
{
struct tagFile *p;
***************
*** 165,170 ****
"import py_compile; py_compile.compile (r'%s')",
p->path);
! if (PyRun_SimpleString (Buffer))
++errors;
SendDlgItemMessage (hDialog, IDC_PROGRESS, PBM_SETPOS, n, 0);
SetDlgItemText (hDialog, IDC_INFO, p->path);
--- 174,183 ----
"import py_compile; py_compile.compile (r'%s')",
p->path);
! if (PyRun_SimpleString (Buffer)) {
++errors;
+ } else {
+ wsprintf(Buffer, "%s%c", p->path, optimize ? 'o' : 'c');
+ notify (FILE_CREATED, Buffer);
+ }
SendDlgItemMessage (hDialog, IDC_PROGRESS, PBM_SETPOS, n, 0);
SetDlgItemText (hDialog, IDC_INFO, p->path);
***************
*** 174,177 ****
--- 187,194 ----
}
+ /*
+ * Returns number of files which failed to compile,
+ * -1 if python could not be loaded at all
+ */
static int compile_filelist (BOOL optimize_flag)
{
***************
*** 190,194 ****
hPython = LoadLibrary (pythondll);
if (!hPython)
! return 1;
Py_Initialize = (void (*)(void))GetProcAddress
(hPython,"Py_Initialize");
--- 207,211 ----
hPython = LoadLibrary (pythondll);
if (!hPython)
! return -1;
Py_Initialize = (void (*)(void))GetProcAddress
(hPython,"Py_Initialize");
***************
*** 205,209 ****
Py_Initialize ();
! errors += do_compile_files (PyRun_SimpleString);
Py_Finalize ();
FreeLibrary (hPython);
--- 222,226 ----
Py_Initialize ();
! errors += do_compile_files (PyRun_SimpleString, optimize_flag);
Py_Finalize ();
FreeLibrary (hPython);
***************
*** 344,347 ****
--- 361,391 ----
}
+
+ static void create_bitmap(HWND hwnd)
+ {
+ BITMAPFILEHEADER *bfh;
+ BITMAPINFO *bi;
+ HDC hdc;
+
+ if (!bitmap_bytes)
+ return;
+
+ if (hBitmap)
+ return;
+
+ hdc = GetDC(hwnd);
+
+ bfh = (BITMAPFILEHEADER *)bitmap_bytes;
+ bi = (BITMAPINFO *)(bitmap_bytes + sizeof(BITMAPFILEHEADER));
+
+ hBitmap = CreateDIBitmap(hdc,
+ &bi->bmiHeader,
+ CBM_INIT,
+ bitmap_bytes + bfh->bfOffBits,
+ bi,
+ DIB_RGB_COLORS);
+ ReleaseDC(hwnd, hdc);
+ }
+
static char *ExtractIniFile (char *data, DWORD size)
{
***************
*** 366,374 ****
}
! if (pmd->tag != 0x12345679 || ofs < 0) {
SystemError (0, "Setup program invalid or damaged");
return NULL;
}
src = ((char *)pmd) - pmd->uncomp_size;
ini_file = malloc (MAX_PATH); /* will be returned, so do not free it */
--- 410,423 ----
}
! if (pmd->tag != 0x1234567A || ofs < 0) {
SystemError (0, "Setup program invalid or damaged");
return NULL;
}
+ if (pmd->bitmap_size) {
+ /* Store pointer to bitmap bytes */
+ bitmap_bytes = (char *)pmd - pmd->uncomp_size - pmd->bitmap_size;
+ }
+
src = ((char *)pmd) - pmd->uncomp_size;
ini_file = malloc (MAX_PATH); /* will be returned, so do not free it */
***************
*** 382,386 ****
dst = map_new_file (CREATE_ALWAYS, ini_file, NULL, pmd->uncomp_size,
! 0, 0, notify);
if (!dst)
return NULL;
--- 431,435 ----
dst = map_new_file (CREATE_ALWAYS, ini_file, NULL, pmd->uncomp_size,
! 0, 0, NULL/*notify*/);
if (!dst)
return NULL;
***************
*** 484,489 ****
--- 533,543 ----
LPNMHDR lpnm;
char Buffer[4096];
+
switch (msg) {
case WM_INITDIALOG:
+ create_bitmap(hwnd);
+ if (hBitmap)
+ SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
+ IMAGE_BITMAP, (LPARAM)hBitmap);
CenterWindow (GetParent (hwnd));
wsprintf (Buffer,
***************
*** 574,577 ****
--- 628,634 ----
switch (msg) {
case WM_INITDIALOG:
+ if (hBitmap)
+ SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
+ IMAGE_BITMAP, (LPARAM)hBitmap);
GetPythonVersions (GetDlgItem (hwnd, IDC_VERSIONS_LIST),
HKEY_LOCAL_MACHINE, target_version);
***************
*** 683,686 ****
--- 740,746 ----
switch (msg) {
case WM_INITDIALOG:
+ if (hBitmap)
+ SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
+ IMAGE_BITMAP, (LPARAM)hBitmap);
wsprintf (Buffer,
"Click Next to begin the installation of %s. "
***************
*** 711,715 ****
PropSheet_SetWizButtons(GetParent(hwnd),
PSWIZB_BACK | PSWIZB_NEXT);
-
break;
--- 771,774 ----
***************
*** 735,746 ****
/* Compile the py-files */
if (pyc_compile) {
SetDlgItemText (hwnd, IDC_TITLE,
"Compiling files to .pyc...");
! compile_filelist (FALSE);
}
if (pyo_compile) {
SetDlgItemText (hwnd, IDC_TITLE,
"Compiling files to .pyo...");
! compile_filelist (TRUE);
}
break;
--- 794,814 ----
/* Compile the py-files */
if (pyc_compile) {
+ int errors;
SetDlgItemText (hwnd, IDC_TITLE,
"Compiling files to .pyc...");
! errors = compile_filelist (FALSE);
! /* Compilation errors are intentionally ignored:
! * Python2.0 contains a bug which will result
! * in sys.path containing garbage under certain
! * circumstances, and an error message will only
! * confuse the user.
! */
}
if (pyo_compile) {
+ int errors;
SetDlgItemText (hwnd, IDC_TITLE,
"Compiling files to .pyo...");
! errors = compile_filelist (TRUE);
! /* Errors ignored: see above */
}
break;
***************
*** 764,770 ****
switch (msg) {
case WM_INITDIALOG:
if (!success)
SetDlgItemText (hwnd, IDC_INFO, "Installation failed.");
! break;
case WM_NOTIFY:
--- 832,841 ----
switch (msg) {
case WM_INITDIALOG:
+ if (hBitmap)
+ SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
+ IMAGE_BITMAP, (LPARAM)hBitmap);
if (!success)
SetDlgItemText (hwnd, IDC_INFO, "Installation failed.");
! return TRUE;
case WM_NOTIFY:
***************
*** 846,851 ****
LPSTR lpszCmdLine, INT nCmdShow)
{
- char modulename[MAX_PATH];
-
GetModuleFileName (NULL, modulename, sizeof (modulename));
--- 917,920 ----
***************
*** 896,899 ****
--- 965,971 ----
if (ini_file)
DeleteFile (ini_file);
+
+ if (hBitmap)
+ DeleteObject(hBitmap);
return 0;
Index: install.rc
===================================================================
RCS file: /cvsroot/python/distutils/misc/install.rc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** install.rc 2000/09/09 21:15:16 1.4
--- install.rc 2001/02/19 09:19:07 1.5
***************
*** 92,97 ****
IDC_TITLE,125,10,179,31,NOT WS_GROUP
EDITTEXT IDC_INTRO_TEXT,125,41,179,120,ES_MULTILINE | ES_READONLY |
! WS_VSCROLL | WS_HSCROLL
! CONTROL 110,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
LTEXT "",IDC_BUILD_INFO,125,163,179,8
--- 92,97 ----
IDC_TITLE,125,10,179,31,NOT WS_GROUP
EDITTEXT IDC_INTRO_TEXT,125,41,179,120,ES_MULTILINE | ES_READONLY |
! WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
! CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
LTEXT "",IDC_BUILD_INFO,125,163,179,8
***************
*** 109,113 ****
LISTBOX IDC_VERSIONS_LIST,125,41,179,100,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
! CONTROL 110,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
END
--- 109,113 ----
LISTBOX IDC_VERSIONS_LIST,125,41,179,100,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
! CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
END
***************
*** 116,120 ****
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Setup"
! FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.",
--- 116,120 ----
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Setup"
! FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.",
***************
*** 123,127 ****
125,157,179,14
CTEXT "Installation progress:",IDC_INFO,125,137,179,8
! CONTROL 110,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
END
--- 123,127 ----
125,157,179,14
CTEXT "Installation progress:",IDC_INFO,125,137,179,8
! CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
END
***************
*** 130,138 ****
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Setup"
! FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Click the Finish button to exit the Setup wizard.",
IDC_TITLE,125,10,179,31,NOT WS_GROUP
! CONTROL 110,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
LTEXT "Installation completed successfully.",IDC_INFO,125,41,
--- 130,138 ----
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Setup"
! FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Click the Finish button to exit the Setup wizard.",
IDC_TITLE,125,10,179,31,NOT WS_GROUP
! CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
104,163,WS_EX_CLIENTEDGE
LTEXT "Installation completed successfully.",IDC_INFO,125,41,
Index: resource.h
===================================================================
RCS file: /cvsroot/python/distutils/misc/resource.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** resource.h 2000/09/09 21:15:16 1.4
--- resource.h 2001/02/19 09:19:07 1.5
***************
*** 23,26 ****
--- 23,27 ----
#define IDC_VERSIONS_LIST 1022
#define IDC_BUILD_INFO 1024
+ #define IDC_BITMAP 1025
// Next default values for new objects
***************
*** 30,34 ****
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
! #define _APS_NEXT_CONTROL_VALUE 1025
#define _APS_NEXT_SYMED_VALUE 101
#endif
--- 31,35 ----
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
! #define _APS_NEXT_CONTROL_VALUE 1026
#define _APS_NEXT_SYMED_VALUE 101
#endif
Index: wininst.exe
===================================================================
RCS file: /cvsroot/python/distutils/misc/wininst.exe,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
Binary files /tmp/cvsYHD1If and /tmp/cvs2JqH1k differ