Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid TOML #2

Closed
LKedward opened this issue Aug 3, 2020 · 4 comments · Fixed by #3
Closed

Invalid TOML #2

LKedward opened this issue Aug 3, 2020 · 4 comments · Fixed by #3

Comments

@LKedward
Copy link
Contributor

LKedward commented Aug 3, 2020

Hi @urbanjost,
I'm doing some work (fortran-lang/fpm-registry#11) on the fpm-registry in order to get fpm packages listed on the website.

As part of this I've been parsing fpm.toml files from each package in the registry and I've noticed that M_CLI uses an invalid TOML syntax. Though Haskell fpm doesn't complain about this, it is causing some issues when parsing the TOML in Python.

According to the spec, there must be a newline after each key/value pair.
I believe the minimal syntax you are looking for can be achieved with inline tables, see here (scroll up slightly).

If I get time later, I can put together a pull request.

LKedward added a commit to LKedward/M_CLI that referenced this issue Aug 4, 2020
@LKedward
Copy link
Contributor Author

LKedward commented Aug 4, 2020

For you own reference, here's a stand-alone script to verify TOML in Python:

import sys, toml

filename = 'fpm.toml'
with open(filename, 'r') as myfile:
            data=myfile.read()

p = toml.loads(data)
print(p)

toml.loads() will fail with an exception in the TOML is invalid.

@urbanjost
Copy link
Owner

Thanks. Problem is I wrote about ten of them the same way, so I need to re-apply your changes. fpm(1) appeared to work fine with them the way they wer with the fpm(1) version I currently have so I would not have noticed till fpm(1) refused to read them, I suspect.

@urbanjost
Copy link
Owner

urbanjost commented Aug 13, 2020 via email

@LKedward
Copy link
Contributor Author

Sounds good. Sorry, for some reason I'd thought toml was a built-in Python package - you'll need to fetch it with pip or similar.
It's a defect in the Haskell toml package that caused it; I will be sure to check the new Fortran implementation when it is ready.

Also any fpm. toml issues are now automatically detected if you submit your package to https://github.com/fortran-lang/fpm-registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants