From: Ronald Oussoren Date: Tue, 22 Sep 2009 14:26:55 +0000 (+0000) Subject: Merged revisions 75017 via svnmerge from X-Git-Tag: v2.6.3rc1~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5270fce038be8edc2379090b36780191f8a4bcfb;p=python Merged revisions 75017 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r75017 | ronald.oussoren | 2009-09-22 16:24:57 +0200 (Tue, 22 Sep 2009) | 4 lines The 'Navigation Toolbox' is not available at all for 64-bit code, make this explicit in the C code to avoid confusing error messages during the build. ........ --- diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index e03a06ea73..1c1777663c 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -33,6 +33,8 @@ PERFORMANCE OF THIS SOFTWARE. #include "pymactoolbox.h" #include +#ifndef __LP64__ + static PyObject *ErrorObject; static NavEventUPP my_eventProcUPP; @@ -184,22 +186,18 @@ filldialogoptions(PyObject *d, } else if( strcmp(keystr, "preferenceKey") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) ) return 0; -#ifndef __LP64__ } else if( strcmp(keystr, "popupExtension") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) ) return 0; -#endif /* !__LP64__ */ } else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) { *eventProcP = my_eventProcUPP; } else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) { *previewProcP = my_previewProcUPP; } else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) { *filterProcP = my_filterProcUPP; -#ifndef __LP64__ } else if( typeListP && strcmp(keystr, "typeList") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) ) return 0; -#endif /* !__LP64__ */ } else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) ) return 0; @@ -306,22 +304,14 @@ static PyObject * navrr_getattr(navrrobject *self, char *name) { FSRef fsr; -#ifndef __LP64__ FSSpec fss; -#endif /* !__LP64__ */ if( strcmp(name, "__members__") == 0 ) return Py_BuildValue( -#ifndef __LP64__ - "ssssssssss", -#else /* __LP64__ */ "ssssssssss", -#endif /* __LP64__ */ "version", "validRecord", "replacing", "isStationery", "translationNeeded", -#ifndef __LP64__ "selection", -#endif /* !__LP64__ */ "selection_fsr", "fileTranslation", "keyScript", "saveFileName"); @@ -335,7 +325,6 @@ navrr_getattr(navrrobject *self, char *name) return Py_BuildValue("l", (long)self->itself.isStationery); if( strcmp(name, "translationNeeded") == 0 ) return Py_BuildValue("l", (long)self->itself.translationNeeded); -#ifndef __LP64__ if( strcmp(name, "selection") == 0 ) { SInt32 i; long count; @@ -367,7 +356,6 @@ navrr_getattr(navrrobject *self, char *name) } return rv; } -#endif /* !__LP64__ */ if( strcmp(name, "selection_fsr") == 0 ) { SInt32 i; long count; @@ -399,10 +387,8 @@ navrr_getattr(navrrobject *self, char *name) } return rv; } -#ifndef __LP64__ if( strcmp(name, "fileTranslation") == 0 ) return ResObj_New((Handle)self->itself.fileTranslation); -#endif if( strcmp(name, "keyScript") == 0 ) return Py_BuildValue("h", (short)self->itself.keyScript); if( strcmp(name, "saveFileName") == 0 ) @@ -885,11 +871,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args) return NULL; } return Py_BuildValue( -#ifndef __LP64__ "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", -#else /* __LP64__ */ - "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", -#endif /* __LP64__ */ "version", dialogOptions.version, "dialogOptionFlags", dialogOptions.dialogOptionFlags, "location", PyMac_BuildPoint, dialogOptions.location, @@ -900,9 +882,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args) "savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName, "message", PyMac_BuildStr255, &dialogOptions.message, "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey -#ifndef __LP64__ ,"popupExtension", OptResObj_New, dialogOptions.popupExtension -#endif /* __LP64__ */ ); } @@ -943,6 +923,10 @@ static char Nav_module_documentation[] = "Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism." ; + +#endif /* !__LP64__ */ + + void initNav(void) { @@ -951,6 +935,12 @@ initNav(void) if (PyErr_WarnPy3k("In 3.x, Nav is removed.", 1)) return; +#ifdef __LP64__ + PyErr_SetString(PyExc_ImportError, "Navigation Services not available in 64-bit mode"); + return; + +#else /* !__LP64__ */ + /* Test that we have NavServices */ if ( !NavServicesAvailable() ) { PyErr_SetString(PyExc_ImportError, "Navigation Services not available"); @@ -972,6 +962,7 @@ initNav(void) my_eventProcUPP = NewNavEventUPP(my_eventProc); my_previewProcUPP = NewNavPreviewUPP(my_previewProc); my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc); +#endif /* !__LP64__ */ }