示例#1
0
文件: build.py 项目: cbeigong/ycmd
def CustomPythonCmakeArgs():
    # The CMake 'FindPythonLibs' Module does not work properly.
    # So we are forced to do its job for it.

    python_prefix = sh.python_config('--prefix').strip()
    if p.isfile(p.join(python_prefix, '/Python')):
        python_library = p.join(python_prefix, '/Python')
        python_include = p.join(python_prefix, '/Headers')
    else:
        which_python = sh.python(
            '-c',
            'import sys;i=sys.version_info;print "python%d.%d" % (i.major, i.minor)'
        ).strip()
        lib_python = '{0}/lib/lib{1}'.format(python_prefix,
                                             which_python).strip()

        if p.isfile('{0}.a'.format(lib_python)):
            python_library = '{0}.a'.format(lib_python)
        # This check is for for CYGWIN
        elif p.isfile('{0}.dll.a'.format(lib_python)):
            python_library = '{0}.dll.a'.format(lib_python)
        else:
            python_library = '{0}.dylib'.format(lib_python)
        python_include = '{0}/include/{1}'.format(python_prefix, which_python)

    return [
        '-DPYTHON_LIBRARY={0}'.format(python_library),
        '-DPYTHON_INCLUDE_DIR={0}'.format(python_include)
    ]
示例#2
0
def CustomPythonCmakeArgs():
  # The CMake 'FindPythonLibs' Module does not work properly.
  # So we are forced to do its job for it.

  python_prefix = sh.python_config( '--prefix' ).strip()
  if p.isfile( p.join( python_prefix, '/Python' ) ):
    python_library = p.join( python_prefix, '/Python' )
    python_include = p.join( python_prefix, '/Headers' )
  else:
    which_python = sh.python(
      '-c',
      'import sys;i=sys.version_info;print "python%d.%d" % (i[0], i[1])'
      ).strip()
    lib_python = '{0}/lib/lib{1}'.format( python_prefix, which_python ).strip()

    if p.isfile( '{0}.a'.format( lib_python ) ):
      python_library = '{0}.a'.format( lib_python )
    # This check is for CYGWIN
    elif p.isfile( '{0}.dll.a'.format( lib_python ) ):
      python_library = '{0}.dll.a'.format( lib_python )
    else:
      python_library = '{0}.dylib'.format( lib_python )
    python_include = '{0}/include/{1}'.format( python_prefix, which_python )

  return [
    '-DPYTHON_LIBRARY={0}'.format( python_library ),
    '-DPYTHON_INCLUDE_DIR={0}'.format( python_include )
  ]