Merge pull request #3424 from kivy/add_get_includes

Add get includes
This commit is contained in:
matham 2015-07-04 17:26:13 -04:00
commit 1d3b9031ef
2 changed files with 32 additions and 16 deletions

View File

@ -135,6 +135,17 @@ def kivy_configure():
callback()
def get_includes():
'''Retrieves the directories containing includes needed to build new Cython
modules with Kivy as a dependency. Currently returns the location of the
kivy.graphics module.
.. versionadded:: 1.9.2
'''
root_dir = dirname(__file__)
return [join(root_dir, 'graphics'), join(root_dir, 'tools', 'gles_compat')]
def kivy_register_post_configuration(callback):
'''Register a function to be called when kivy_configure() is called.
@ -226,7 +237,7 @@ kivy_data_dir = environ.get('KIVY_DATA_DIR',
join(kivy_base_dir, 'data'))
#: Kivy binary deps directory
kivy_binary_deps_dir = environ.get('KIVY_BINARY_DEPS',
join(kivy_base_dir, 'binary_deps'))
join(kivy_base_dir, 'binary_deps'))
#: Kivy glsl shader directory
kivy_shader_dir = join(kivy_data_dir, 'glsl')
#: Kivy icons config path (don't remove the last '')
@ -289,8 +300,8 @@ if not environ.get('KIVY_DOC_INCLUDE'):
# Can be overrided in command line
if ('KIVY_UNITTEST' not in environ and
'KIVY_PACKAGING' not in environ and
'KIVY_NO_ARGS' not in environ):
'KIVY_PACKAGING' not in environ and
'KIVY_NO_ARGS' not in environ):
# save sys argv, otherwize, gstreamer use it and display help..
sys_argv = sys.argv
sys.argv = sys.argv[:1]
@ -402,4 +413,3 @@ if not environ.get('KIVY_DOC_INCLUDE'):
Logger.info('Kivy: v%s' % (__version__))
Logger.info('Python: v{}'.format(sys.version))

View File

@ -211,7 +211,7 @@ class KivyBuildExt(build_ext):
retval = build_ext.finalize_options(self)
global build_path
if (self.build_lib is not None and exists(self.build_lib) and
not self.inplace):
not self.inplace):
build_path = self.build_lib
return retval
@ -250,8 +250,8 @@ class KivyBuildExt(build_ext):
config_pxi += 'DEF DEBUG = {0}\n'.format(debug)
config_py += 'DEBUG = {0}\n'.format(debug)
for fn, content in (
(config_h_fn, config_h), (config_pxi_fn, config_pxi),
(config_py_fn, config_py)):
(config_h_fn, config_h), (config_pxi_fn, config_pxi),
(config_py_fn, config_py)):
build_fn = expand(build_path, *fn)
if self.update_if_changed(build_fn, content):
print('Updated {}'.format(build_fn))
@ -333,7 +333,8 @@ else:
if not c_options['use_opengl_es2']:
print('NOTE: Not found GLES 2.0 headers at: {}'.format(
default_header_dirs))
print(' Please contact us if your distribution '
print(
' Please contact us if your distribution '
'uses an alternative path for the headers.')
print('Using this graphics system: {}'.format(
@ -483,7 +484,8 @@ def determine_base_flags():
sdk_mac_ver = '.'.join(_platform.mac_ver()[0].split('.')[:2])
print('Xcode detected at {}, and using MacOSX{} sdk'.format(
xcode_dev, sdk_mac_ver))
sysroot = join(xcode_dev.decode('utf-8'),
sysroot = join(
xcode_dev.decode('utf-8'),
'Platforms/MacOSX.platform/Developer/SDKs',
'MacOSX{}.sdk'.format(sdk_mac_ver),
'System/Library/Frameworks')
@ -516,7 +518,8 @@ def determine_gl_flags():
flags['extra_link_args'] = ['-L', join(ndkplatform, 'usr', 'lib')]
flags['libraries'] = ['GLESv2']
elif platform == 'rpi':
flags['include_dirs'] = ['/opt/vc/include',
flags['include_dirs'] = [
'/opt/vc/include',
'/opt/vc/include/interface/vcos/pthreads',
'/opt/vc/include/interface/vmcs_host/linux']
flags['library_dirs'] = ['/opt/vc/lib']
@ -618,7 +621,8 @@ graphics_dependencies = {
'instructions.pyx': [
'config.pxi', 'opcodes.pxi', 'c_opengl.pxd', 'c_opengl_debug.pxd',
'context.pxd', 'common.pxi', 'vertex.pxd', 'transformation.pxd'],
'opengl.pyx': ['config.pxi', 'common.pxi', 'c_opengl.pxd', 'gl_redirect.h'],
'opengl.pyx': [
'config.pxi', 'common.pxi', 'c_opengl.pxd', 'gl_redirect.h'],
'opengl_utils.pyx': ['opengl_utils_def.pxi', 'c_opengl.pxd'],
'shader.pxd': ['c_opengl.pxd', 'transformation.pxd', 'vertex.pxd'],
'shader.pyx': [
@ -643,8 +647,8 @@ graphics_dependencies = {
'vertex.pxd': ['c_opengl.pxd'],
'vertex.pyx': ['config.pxi', 'common.pxi'],
'vertex_instructions.pyx': [
'config.pxi', 'common.pxi', 'vbo.pxd', 'vertex.pxd', 'instructions.pxd',
'vertex_instructions.pxd',
'config.pxi', 'common.pxi', 'vbo.pxd', 'vertex.pxd',
'instructions.pxd', 'vertex_instructions.pxd',
'c_opengl.pxd', 'c_opengl_debug.pxd', 'texture.pxd',
'vertex_instructions_line.pxi'],
'vertex_instructions_line.pxi': ['stencil_instructions.pxd']}
@ -800,8 +804,8 @@ def get_extensions_from_sources(sources):
for key, value in flags.items():
if len(value):
flags_clean[key] = value
ext_modules.append(CythonExtension(module_name,
[pyx] + f_depends + c_depends, **flags_clean))
ext_modules.append(CythonExtension(
module_name, [pyx] + f_depends + c_depends, **flags_clean))
return ext_modules
ext_modules = get_extensions_from_sources(sources)
@ -819,7 +823,7 @@ for root, subFolders, files in walk('examples'):
continue
filename = join(root, fn)
directory = '%s%s' % (data_file_prefix, dirname(filename))
if not directory in examples:
if directory not in examples:
examples[directory] = []
examples[directory].append(filename)
@ -888,6 +892,7 @@ setup(
'core/text/*.pxi',
'graphics/*.pxd',
'graphics/*.pxi',
'graphics/*.h',
'lib/vidcore_lite/*.pxd',
'lib/vidcore_lite/*.pxi',
'data/*.kv',
@ -915,6 +920,7 @@ setup(
'tools/packaging/win32/README.txt',
'tools/packaging/osx/Info.plist',
'tools/packaging/osx/InfoPlist.strings',
'tools/gles_compat/*.h',
'tools/packaging/osx/kivy.sh'] + binary_deps},
data_files=list(examples.items()),
classifiers=[