mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
ac87077b37
commit
e50a9fdd2a
|
@ -33,6 +33,8 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "pymactoolbox.h"
|
#include "pymactoolbox.h"
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
|
|
||||||
static PyObject *ErrorObject;
|
static PyObject *ErrorObject;
|
||||||
|
|
||||||
static NavEventUPP my_eventProcUPP;
|
static NavEventUPP my_eventProcUPP;
|
||||||
|
@ -184,22 +186,18 @@ filldialogoptions(PyObject *d,
|
||||||
} else if( strcmp(keystr, "preferenceKey") == 0 ) {
|
} else if( strcmp(keystr, "preferenceKey") == 0 ) {
|
||||||
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
|
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
|
||||||
return 0;
|
return 0;
|
||||||
#ifndef __LP64__
|
|
||||||
} else if( strcmp(keystr, "popupExtension") == 0 ) {
|
} else if( strcmp(keystr, "popupExtension") == 0 ) {
|
||||||
if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
|
if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* !__LP64__ */
|
|
||||||
} else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) {
|
} else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) {
|
||||||
*eventProcP = my_eventProcUPP;
|
*eventProcP = my_eventProcUPP;
|
||||||
} else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) {
|
} else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) {
|
||||||
*previewProcP = my_previewProcUPP;
|
*previewProcP = my_previewProcUPP;
|
||||||
} else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) {
|
} else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) {
|
||||||
*filterProcP = my_filterProcUPP;
|
*filterProcP = my_filterProcUPP;
|
||||||
#ifndef __LP64__
|
|
||||||
} else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
|
} else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
|
||||||
if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
|
if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* !__LP64__ */
|
|
||||||
} else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
|
} else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
|
||||||
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
|
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -306,22 +304,14 @@ static PyObject *
|
||||||
navrr_getattr(navrrobject *self, char *name)
|
navrr_getattr(navrrobject *self, char *name)
|
||||||
{
|
{
|
||||||
FSRef fsr;
|
FSRef fsr;
|
||||||
#ifndef __LP64__
|
|
||||||
FSSpec fss;
|
FSSpec fss;
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
if( strcmp(name, "__members__") == 0 )
|
if( strcmp(name, "__members__") == 0 )
|
||||||
return Py_BuildValue(
|
return Py_BuildValue(
|
||||||
#ifndef __LP64__
|
|
||||||
"ssssssssss",
|
"ssssssssss",
|
||||||
#else /* __LP64__ */
|
|
||||||
"ssssssssss",
|
|
||||||
#endif /* __LP64__ */
|
|
||||||
"version", "validRecord", "replacing",
|
"version", "validRecord", "replacing",
|
||||||
"isStationery", "translationNeeded",
|
"isStationery", "translationNeeded",
|
||||||
#ifndef __LP64__
|
|
||||||
"selection",
|
"selection",
|
||||||
#endif /* !__LP64__ */
|
|
||||||
"selection_fsr",
|
"selection_fsr",
|
||||||
"fileTranslation", "keyScript", "saveFileName");
|
"fileTranslation", "keyScript", "saveFileName");
|
||||||
|
|
||||||
|
@ -335,7 +325,6 @@ navrr_getattr(navrrobject *self, char *name)
|
||||||
return Py_BuildValue("l", (long)self->itself.isStationery);
|
return Py_BuildValue("l", (long)self->itself.isStationery);
|
||||||
if( strcmp(name, "translationNeeded") == 0 )
|
if( strcmp(name, "translationNeeded") == 0 )
|
||||||
return Py_BuildValue("l", (long)self->itself.translationNeeded);
|
return Py_BuildValue("l", (long)self->itself.translationNeeded);
|
||||||
#ifndef __LP64__
|
|
||||||
if( strcmp(name, "selection") == 0 ) {
|
if( strcmp(name, "selection") == 0 ) {
|
||||||
SInt32 i;
|
SInt32 i;
|
||||||
long count;
|
long count;
|
||||||
|
@ -367,7 +356,6 @@ navrr_getattr(navrrobject *self, char *name)
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
#endif /* !__LP64__ */
|
|
||||||
if( strcmp(name, "selection_fsr") == 0 ) {
|
if( strcmp(name, "selection_fsr") == 0 ) {
|
||||||
SInt32 i;
|
SInt32 i;
|
||||||
long count;
|
long count;
|
||||||
|
@ -399,10 +387,8 @@ navrr_getattr(navrrobject *self, char *name)
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
#ifndef __LP64__
|
|
||||||
if( strcmp(name, "fileTranslation") == 0 )
|
if( strcmp(name, "fileTranslation") == 0 )
|
||||||
return ResObj_New((Handle)self->itself.fileTranslation);
|
return ResObj_New((Handle)self->itself.fileTranslation);
|
||||||
#endif
|
|
||||||
if( strcmp(name, "keyScript") == 0 )
|
if( strcmp(name, "keyScript") == 0 )
|
||||||
return Py_BuildValue("h", (short)self->itself.keyScript);
|
return Py_BuildValue("h", (short)self->itself.keyScript);
|
||||||
if( strcmp(name, "saveFileName") == 0 )
|
if( strcmp(name, "saveFileName") == 0 )
|
||||||
|
@ -885,11 +871,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return Py_BuildValue(
|
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&}",
|
"{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,
|
"version", dialogOptions.version,
|
||||||
"dialogOptionFlags", dialogOptions.dialogOptionFlags,
|
"dialogOptionFlags", dialogOptions.dialogOptionFlags,
|
||||||
"location", PyMac_BuildPoint, dialogOptions.location,
|
"location", PyMac_BuildPoint, dialogOptions.location,
|
||||||
|
@ -900,9 +882,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
|
||||||
"savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
|
"savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
|
||||||
"message", PyMac_BuildStr255, &dialogOptions.message,
|
"message", PyMac_BuildStr255, &dialogOptions.message,
|
||||||
"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
|
"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
|
||||||
#ifndef __LP64__
|
|
||||||
,"popupExtension", OptResObj_New, dialogOptions.popupExtension
|
,"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."
|
"Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism."
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !__LP64__ */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
initNav(void)
|
initNav(void)
|
||||||
{
|
{
|
||||||
|
@ -951,6 +935,12 @@ initNav(void)
|
||||||
if (PyErr_WarnPy3k("In 3.x, Nav is removed.", 1))
|
if (PyErr_WarnPy3k("In 3.x, Nav is removed.", 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
PyErr_SetString(PyExc_ImportError, "Navigation Services not available in 64-bit mode");
|
||||||
|
return;
|
||||||
|
|
||||||
|
#else /* !__LP64__ */
|
||||||
|
|
||||||
/* Test that we have NavServices */
|
/* Test that we have NavServices */
|
||||||
if ( !NavServicesAvailable() ) {
|
if ( !NavServicesAvailable() ) {
|
||||||
PyErr_SetString(PyExc_ImportError, "Navigation Services not available");
|
PyErr_SetString(PyExc_ImportError, "Navigation Services not available");
|
||||||
|
@ -972,6 +962,7 @@ initNav(void)
|
||||||
my_eventProcUPP = NewNavEventUPP(my_eventProc);
|
my_eventProcUPP = NewNavEventUPP(my_eventProc);
|
||||||
my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
|
my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
|
||||||
my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
|
my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
|
||||||
|
#endif /* !__LP64__ */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue