Commit ba1d2436 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Merge check for keychain provider, simplified a bit.

parents edeb1d73 a0695a2f
......@@ -37,6 +37,7 @@ Andrew Mitchell
Gustavo Niemeyer
Martin Pool
Garrett Rooney
Jean-Francois Roy
Johan Rydberg
Peter Samuelson
Mark Shuttleworth
......
......@@ -2753,7 +2753,7 @@ static PyObject *get_windows_ssl_server_trust_provider(PyObject *self)
#endif
#endif
#if defined(DARWIN)
#if defined(SVN_KEYCHAIN_PROVIDER_AVAILABLE)
static PyObject *get_keychain_simple_provider(PyObject* self)
{
AuthProviderObject *auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
......@@ -2777,7 +2777,7 @@ static PyMethodDef ra_module_methods[] = {
{ "get_windows_ssl_server_trust_provider", (PyCFunction)get_windows_ssl_server_trust_provider, METH_NOARGS, NULL },
#endif
#endif
#if defined(DARWIN)
#if defined(SVN_KEYCHAIN_PROVIDER_AVAILABLE)
{ "get_keychain_simple_provider", (PyCFunction)get_keychain_simple_provider, METH_NOARGS, NULL },
#endif
{ "get_username_prompt_provider", (PyCFunction)get_username_prompt_provider, METH_VARARGS, NULL },
......
......@@ -106,6 +106,24 @@ def svn_build_data():
raise Exception("Subversion development files not found. "
"Please set SVN_PREFIX or (SVN_LIBRARY_PATH and SVN_HEADER_PATH) environment variable. ")
def is_keychain_provider_available():
"""
Checks for the availability of the Keychain simple authentication provider in Subversion by compiling a simple test program.
"""
abd = apr_build_data()
sbd = svn_build_data()
gcc_command_args = ['gcc'] + ['-I' + inc for inc in sbd[0]] + ['-L' + lib for lib in sbd[1]] + ['-I' + abd[0], '-lsvn_subr-1', '-x', 'c', '-']
(gcc_in, gcc_out, gcc_err) = os.popen3(gcc_command_args)
gcc_in.write("""
#include <svn_auth.h>
int main(int argc, const char* arv[]) {
svn_auth_get_keychain_simple_provider(NULL, NULL);
}
""")
gcc_in.close()
gcc_out.read()
return (gcc_out.close() is None)
class VersionQuery(object):
def __init__(self, filename):
self.filename = filename
......@@ -218,6 +236,13 @@ def SvnExtension(name, *args, **kwargs):
kwargs["libraries"] = extra_libs
# APR needs WIN32 defined.
kwargs["define_macros"] = [("WIN32", None)]
is_keychain_provider_available()
if sys.platform == 'darwin':
# on Mac OS X, we need to check for Keychain availability
if is_keychain_provider_available():
if "define_macros" not in kwargs:
kwargs["define_macros"] = []
kwargs["define_macros"].extend((('DARWIN', None), ('SVN_KEYCHAIN_PROVIDER_AVAILABLE', '1')))
return Extension("bzrlib.plugins.svn.%s" % name, *args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment