Skip to content

compdb fails when using 'arguments' instead of 'command' in compile database #3

@richleigh

Description

@richleigh

When using a tool such as bear (https://github.com/rizsotto/Bear) to build the compilation database for a Makefile based project, the generated compilation database uses the 'arguments' key instead of the 'command' key.

To reproduce:

git clone https://github.com/mbcrawfo/GenericMakefile.git
cd GenericMakefile/cpp
bear make
compdb -p . list

Result:

[
]
Traceback (most recent call last):
  File "/home/rich/bin/compdb", line 9, in <module>
    load_entry_point('compdb==0.1.1', 'console_scripts', 'compdb')()
  File "/home/rich/.local/lib/python2.7/site-packages/compdb-0.1.1-py2.7.egg/compdb/cli.py", line 559, in main
    command.execute()
  File "/home/rich/.local/lib/python2.7/site-packages/compdb-0.1.1-py2.7.egg/compdb/cli.py", line 239, in execute
    for compile_command in compile_commands:
  File "/home/rich/.local/lib/python2.7/site-packages/compdb-0.1.1-py2.7.egg/compdb/core.py", line 50, in <genexpr>
    for db in databases))
  File "/home/rich/.local/lib/python2.7/site-packages/compdb-0.1.1-py2.7.egg/compdb/db/json.py", line 38, in get_all_compile_commands
    return map(self._dict_to_compile_command, self._data)
  File "/home/rich/.local/lib/python2.7/site-packages/compdb-0.1.1-py2.7.egg/compdb/db/json.py", line 43, in _dict_to_compile_command
    shlex.split(d['command']))
KeyError: u'command'

Things that use libclang, such as YCM seem fine with both cmake and bear derived compilation databases, so it would be great if compdb supported both.

This was using compdb 0.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions