[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21455] branches/blender2.5/blender/source /blender/python/intern/bpy_interface.c: removed check for pyc when scanning the directory of python files.
Campbell Barton
ideasman42 at gmail.com
Thu Jul 9 09:35:35 CEST 2009
Revision: 21455
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21455
Author: campbellbarton
Date: 2009-07-09 09:35:35 +0200 (Thu, 09 Jul 2009)
Log Message:
-----------
removed check for pyc when scanning the directory of python files.
Brecht, double checked and pyc or pyo files arent used because of the (file_extension[3] == '\0') test.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/python/intern/bpy_interface.c
Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_interface.c 2009-07-09 07:30:21 UTC (rev 21454)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_interface.c 2009-07-09 07:35:35 UTC (rev 21455)
@@ -453,7 +453,7 @@
char *dirname;
char path[FILE_MAX];
char *dirs[] = {"io", "ui", NULL};
- int a, filelen; /* filename length */
+ int a;
PyGILState_STATE gilstate;
PyObject *mod;
@@ -490,15 +490,10 @@
/* We could stat the file but easier just to let python
* import it and complain if theres a problem */
- if(strstr(de->d_name, ".pyc"))
- continue;
-
file_extension = strstr(de->d_name, ".py");
- if(file_extension && *(file_extension + 3) == '\0') {
- filelen = strlen(de->d_name);
- BLI_strncpy(path, de->d_name, filelen-2); /* cut off the .py on copy */
-
+ if(file_extension && file_extension[3] == '\0') {
+ BLI_strncpy(path, de->d_name, (file_extension - de->d_name) + 1); /* cut off the .py on copy */
mod= PyImport_ImportModuleLevel(path, NULL, NULL, NULL, 0);
if (mod) {
if (reload) {
@@ -511,7 +506,7 @@
if(mod) {
Py_DECREF(mod); /* could be NULL from reloading */
} else {
- BPy_errors_to_report(NULL); // TODO - reports
+ BPy_errors_to_report(NULL);
fprintf(stderr, "unable to import \"%s\" %s/%s\n", path, dirname, de->d_name);
}
More information about the Bf-blender-cvs
mailing list