-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Missing documentation on nimdoc.css #14424
Comments
|
The issue can be reproduced if the doc/ directory is missing in the nim installation:
But the error is also now more informative. This issue is probably a duplicate of #13191. |
@timotheecour This makes me think.. as the |
how was
one could make a case for either |
I admit that it was using my local script that creates a minimal installation footprint of nim for my work. Just for
It feels rather odd that something that |
I am looking forward to see the outcome of that PR. Right now, I have a custom config.nims |
I'm fine with the idea of a miminal footprint install, but this really should be done via some API (tested in testament), not by guessing which files to include, otherwise things are guaranteed to break at some point (like here); nim should have some freedom to keep internal details as implementation details, while providing an API to do things like that. That's the more robust thing IMO (moving around nimdoc.css would not address future internal changes, including that new dochacks.nim/js dependency)
the idea is for index+search to "just work" for any project with a single command (and making --index on be new default soon after)
hopefully #14324 will simplify your script and make it more robust :) (dochack.nim should be tied to your nim repo, not to a fixed origin like one thing I've left as TODO is fixing href's to dochack.js in case of nested dirs; help welcome there closing this issueSo what's needed to close this PR, assuming that OP was using non standard installation if I'm reading #14424 (comment) correctly? we already have |
I'll let the OP comment on if this issue can be closed. For me, personally, I understood the risks, and adapted the minimal download script for my own use. I don't think that the |
+1 I will follow the development of that PR. I looks like a much involving PR, so I probably cannot help much there. But I can help test out the PR. We can continue discussion about that PR in its thread. |
@timotheecour the issue was found in this nightly build: https://github.com/nim-lang/nightlies/releases/tag/2020-05-20-version-1-2-7800fa3 which is designate as rc1 for 1.2.2 |
Note to self: https://nim-lang.github.io/Nim/packaging.html should be updated with the solution |
compiler expects nimdoc.css to be in the same tree as system.nim Lines 23 to 24 in 5d95137
i.e. /usr/lib/nim/doc but no mention of this in docs and absent instructions to the contrary e.g. Arch puts them under /usr/share/nim/doc |
@shirleyquirk please cross-link to avoid splitting discussion; i did it for you here: https://forum.nim-lang.org/t/7679#48913 choosenim installs it to:
maybe that's the bug? can you show output of
|
Debian (sid,unstable, 1.4.2) puts it in /usr/lib/nim/doc, which probably doesn't work, either. arch provides a symlink meaning /usr/lib/nim/doc/nimdoc.css exists, referencing a bug from version 0.13 and the 'nim doc2' command. installation instructions say "The expected stdlib location is /usr/lib/nim" which is sensible. Lines 627 to 640 in 64e6670
so if the compiler binary is in /usr/bin/nim then the compiler expects to find nimdoc.css under /usr/doc/nimdoc.css and if /usr/local/bin/nim then /usr/local/doc/nimdoc.css it would be antisocial to put nims docs under /usr/doc meaning the whole nim tree would have to go under /opt with the other antisocial packages, but that would require changes to all distro's installations the path of least resistance is probably to add a check here in docgen.nim to look under nimr/lib/nim as well if file not found? |
can't we fix the distro's installation scripts so that they don't shuffle the installation files in a platform specific way? there are other things besides in ideal world, every installed nim (via choosenim or otherwise) respects the original layout |
yes, that's possible, change the packaging instructions to put the whole nim tree in /opt or somewhere. i dont like that solution, it multiplies the amount of work by the number of distros, would probably break a lot of users installations, and goes against conventional expectations (binary under /usr/bin, library under /lib, headers under /usr/include) it's understandable that a packager would expect 'doc' to contain the documentation, indeed it's listed as optional in the packaging info, but if nimdoc.css and dochack etc are requirements for the toolchain, they should live under /lib/nim imho. |
can you point to the source code where those packaging instructions are written? |
I agree! As I mentioned earlier, to anyone unknown with this special dependency, the doc directory would look like something optional and not a requirement for Nim commands to work. @timotheecour Can the doc related files like css and js be moved to a |
these instructions are out of date, and should be updated (eg to use
where would like like there are other dependencies besides again, ideally files are copied as is so that relative paths wrt nim binary work regardless of the installation platform; that said, it would be ok to reorganize a bit some of files nim relies on so that they're all inside some subdirectory of |
I actually meant |
I'd be ok with option 1: extras= with either option we can write a PR as follows:
anything else missing? note that option 1 vs 2 matters because of the |
This makes it less appealing to ship the .css file in the So this leads me to https://tldp.org/HOWTO/HighQuality-Apps-HOWTO/fhs.html .. Would it then be better to put things in
|
that's not what I'm saying;
it boils down to whether extras are tied to nim binary or to stdlib distribution |
I am running arch, and I am new to nim. Today, I ran into the issue when attempting to generate docs, how can I fix this? |
PR welcome to proceed as described here: #14424 (comment) |
Is what I'm proposing, would that be acceptable? |
see how
We could apply a similar logic to Given that, why can't we just copy all whitelisted files during installation by retaining the original layout? example 1:nim binary: $nim becomes: example 2:nim binary: this would work regardless of whether extras goes under $nim/extras or $nim/lib/extras (and extras wouldn't even be needed anymore), and relative paths (including with |
Workaround: Locate the files in the Nim sources and copy them to:
Then compile dochack in the same directory |
Regardless, the default paths in the Nim codebase should allow overriding by package maintainers. Nim should not hardcode paths in undocumented consts or make assumptions or guesswork. Can we gather all the "const" paths in a single |
Are there any updates/proposed workarounds for this? |
I just ran into this on FreeBSD (12.3-RELEASE) Nimdoc expects:
Workaround was to create the expected dir and a symlink to the CSS file:
|
for previous version, I wrote this patch |
I believe that I've just fixed this for FreeBSD with the upcoming update of lang/nim to 1.6.10. It took some "cheating" during the port build as the code seems to have some very fixed ideas about where things should be, which are unfortunately places not allowed in FreeBSD. The installation does not require any links though, so it's relatively clean. |
nim doc
fails to run when nimdoc.css is not found. The error message does not indicate how to configure the correct pathnim doc
compiler/docgen.nim
sets the path tod.conf.getPrefixDir() / "doc" / "nimdoc.css"
apparently without a way to override itThe text was updated successfully, but these errors were encountered: