def find_ndk_project_root(source):
 ndk_directory = os.path.abspath(source)
 while (ndk_directory != '/'):
  if os.path.exists(os.path.join(ndk_directory, 'jni')):
   break
  ndk_directory = os.path.dirname(ndk_directory)
 else:
  return None
 return ndk_directory

def find_ndk_project_root ( source ) : ndk_directory = os . path . abspath ( source ) while ( ndk_directory != '/' ) : if os . path . exists ( os . path . join ( ndk_directory , 'jni' ) ) : break ndk_directory = os . path . dirname ( ndk_directory ) else : return None return ndk_directory
given a directory path .