Exemple #1
0
def _PathToPythonUsedDuringBuild():
    from ycmd import utils

    try:
        filepath = os.path.join(DIR_OF_YCMD, 'PYTHON_USED_DURING_BUILDING')
        return utils.ReadFile(filepath).strip()
    except OSError:
        return None
Exemple #2
0
def _PathToPythonUsedDuringBuild():
  from ycmd import utils

  try:
    filepath = os.path.join( DIR_OF_YCMD, 'PYTHON_USED_DURING_BUILDING' )
    return utils.ReadFile( filepath ).strip()
  # We need to check for IOError for Python2 and OSError for Python3
  except ( IOError, OSError ):
    return None
Exemple #3
0
def _CollectExtensionBundles(extension_path):
    extension_bundles = []

    for extension_dir in extension_path:
        if not os.path.isdir(extension_dir):
            LOGGER.info('extension directory does not exist: {0}'.format(
                extension_dir))
            continue

        for path in os.listdir(extension_dir):
            path = os.path.join(extension_dir, path)
            manifest_file = os.path.join(path, 'package.json')

            if not os.path.isdir(path) or not os.path.isfile(manifest_file):
                LOGGER.debug('{0} is not an extension directory'.format(path))
                continue

            manifest_json = utils.ReadFile(manifest_file)
            try:
                manifest = json.loads(manifest_json)
            except ValueError:
                LOGGER.exception(
                    'Could not load bundle {0}'.format(manifest_file))
                continue

            if ('contributes' not in manifest
                    or 'javaExtensions' not in manifest['contributes']
                    or not isinstance(
                        manifest['contributes']['javaExtensions'], list)):
                LOGGER.info(
                    'Bundle {0} is not a java extension'.format(manifest_file))
                continue

            LOGGER.info('Found bundle: {0}'.format(manifest_file))

            extension_bundles.extend([
                os.path.join(path, p)
                for p in manifest['contributes']['javaExtensions']
            ])

    return extension_bundles