nimble
nimble copied to clipboard
Warning about incorrect structure is misleading
nimble install nigui gives the following warning:
Package 'nigui' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'nigui', but file 'windows.nim' is in a directory named 'src/nigui/private/windows' instead. This will be an error in the future.
The real issue in my case was, that in my nimble file srcDir = "src" was missing. After I added this, the warning is gone.
Upon installing nim-lang/cairo on linux I got a similar yet different one.
Installing cairo@>= 1.1.1
Downloading https://github.com/nim-lang/cairo using git
Warning: Package 'cairo' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'cairo.nim', but a file named 'cairo_pragma.nim' was found. This will be an error in the future.
Hint: If this is the primary source file in the package, rename it to 'cairo.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'cairo', then move it into a 'cairo/' subdirectory. If it's a test file or otherwise not required to build the the package 'cairo.nim', prevent its installation by adding `skipFiles = @["cairo_pragma.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
Verifying dependencies for [email protected]
Installing [email protected]
They do, however, have the srcDir = "src" inside their nimble file. Is this a false positive? Why can't a file be named <packagename>_<something_else>.nim when there is also a <packagename>.nim present?
folder src of the cairo package:

All the files apart from cairo.nim should be in a folder called cairo. This isn't a false positive.
Right now cairo_pragma would be imported via import cairo_pragma which means that this package is taking over the name of cairo_pragma (as well as cairoft, cairowin32 etc.) This would prevent other packages using these names.