Conan: Syntax for conanfile.txt

Created on 27 May 2017  路  6Comments  路  Source: conan-io/conan

What is the exact syntax for conanfile.txt? How can I write a comment?

Most helpful comment

Yes, I agree conanfile.txt format is really simple and good enough for our case. But I think we should consider it for Conan 2.0 anyway. Thanks for commenting.

All 6 comments

You can find its reference here: http://docs.conan.io/en/latest/reference/conanfile_txt.html
There are comments in the examples, with #
Anything you find missing or we can improve? Actually if there is something, please open issue better on https://github.com/conan-io/docs repo. Thank you!

You can find its reference here: http://docs.conan.io/en/latest/reference/conanfile_txt.html
There are comments in the examples, with #
Anything you find missing or we can improve? Actually if there is something, please open issue better on https://github.com/conan-io/docs repo. Thank you!

@memsharded
Follow up question: What format is it based on?
I want to know to be able to enable proper syntax highlighting for my editor (.vscode). I know it is not .INI since it's not consisted of only key=value pairs. Sometimes there are key=value pairs and sometimes just values:

[section1]
key1=value1
value2

Hi @daravi,

Yes, it is not INI, it is a custom configuration file, that evolved at the very beginning, adding functionality as needed with custom syntax. I'd use INI highlighter, might be the closer one.

In any case, conanfile.txt are really simple (besides the imports section), so if you feel you need syntax highlighting for your conanfile.txt files, you might better use a conanfile.py (it can be for consuming only, not necessary to implement the package creation methods), and that will use python style and highlighting.

I know this place is not right one for a new discussion, but ...

Why not adopt some standard format? I think TOML could be good candidate in this case. It looks like .INI but with steroids. For example, Gitlab uses TOML as official format for configuration files.
Also there are good python parsers, so we won't need to think about how to parse or maintain our config files.

Sorry for the noise.

Yes, it seems it would make sense to use something standard like TOML, but:

  • That would break massively to users, can't be done until 2.0
  • In any case, the conanfile.txt is so simple and stable, it hasn't been a real issue since the beginning.

Yes, I agree conanfile.txt format is really simple and good enough for our case. But I think we should consider it for Conan 2.0 anyway. Thanks for commenting.

Was this page helpful?
0 / 5 - 0 ratings