[Python-checkins] distutils/misc install.c,1.19,1.20

theller@users.sourceforge.net theller@users.sourceforge.net
Wed, 16 Oct 2002 10:49:01 -0700


Update of /cvsroot/python/distutils/misc
In directory usw-pr-cvs1:/tmp/cvs-serv6020

Modified Files:
	install.c 
Log Message:
More functions for the pre/post install script:
file_created(path) - mark a file for deletion by the uninstaller
directory_created(path) - mark a directory for deletion by the uninstaller

Return None from functions which have nothing to return.


Index: install.c
===================================================================
RCS file: /cvsroot/python/distutils/misc/install.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** install.c	15 Oct 2002 19:41:24 -0000	1.19
--- install.c	16 Oct 2002 17:48:58 -0000	1.20
***************
*** 352,355 ****
--- 352,373 ----
  #define DIM(a) (sizeof(a) / sizeof((a)[0]))
  
+ static PyObject *FileCreated(PyObject *self, PyObject *args)
+ {
+     char *path;
+     if (!g_PyArg_ParseTuple(args, "s", &path))
+ 	return NULL;
+     notify(FILE_CREATED, path);
+     return g_Py_BuildValue("");
+ }
+ 
+ static PyObject *DirectoryCreated(PyObject *self, PyObject *args)
+ {
+     char *path;
+     if (!g_PyArg_ParseTuple(args, "s", &path))
+ 	return NULL;
+     notify(DIR_CREATED, path);
+     return g_Py_BuildValue("");
+ }
+ 
  static PyObject *GetSpecialFolderPath(PyObject *self, PyObject *args)
  {
***************
*** 482,486 ****
      ps1->lpVtbl->Release(ps1);
      CoUninitialize();
!     return g_Py_BuildValue("i", 0);
      
    error:
--- 500,504 ----
      ps1->lpVtbl->Release(ps1);
      CoUninitialize();
!     return g_Py_BuildValue("");
      
    error:
***************
*** 501,504 ****
--- 519,524 ----
      {"create_shortcut", CreateShortcut, METH_VARARGS, NULL},
      {"get_special_folder_path", GetSpecialFolderPath, METH_VARARGS, NULL},
+     {"file_created", FileCreated, METH_VARARGS, NULL},
+     {"directory_created", DirectoryCreated, METH_VARARGS, NULL},
  };
  
***************
*** 553,560 ****
      mod = PyImport_ImportModule("__builtin__");
      if (mod) {
  	g_PyExc_ValueError = PyObject_GetAttrString(mod, "ValueError");
  	g_PyExc_OSError = PyObject_GetAttrString(mod, "OSError");
! 	PyObject_SetAttrString(mod, "create_shortcut", PyCFunction_New(&meth[0], NULL));
! 	PyObject_SetAttrString(mod, "get_special_folder_path", PyCFunction_New(&meth[1], NULL));
      }
  
--- 573,584 ----
      mod = PyImport_ImportModule("__builtin__");
      if (mod) {
+ 	int i;
+ 
  	g_PyExc_ValueError = PyObject_GetAttrString(mod, "ValueError");
  	g_PyExc_OSError = PyObject_GetAttrString(mod, "OSError");
! 	for (i = 0; i < DIM(meth); ++i) {
! 	    PyObject_SetAttrString(mod, meth[i].ml_name,
! 				   PyCFunction_New(&meth[i], NULL));
! 	}
      }
  
***************
*** 1608,1613 ****
  		fprintf(logfile, "300 Run Script: [%s]%s\n", pythondll, fname);
  
- 	    CloseLogfile();
- 
  	    tempname = tmpnam(NULL);
  
--- 1632,1635 ----
***************
*** 1646,1649 ****
--- 1668,1672 ----
  
  	    SetCursor(hCursor);
+ 	    CloseLogfile();
  	}