-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
modules: Add an 'hotdoc' module #4016
Conversation
Flake8 detected 6 issues on b4597d0 |
mesonbuild/modules/hotdoc.py
Outdated
from hotdoc.run_hotdoc import run | ||
except Exception as e: | ||
raise MesonException('hotdoc %s required but not found. (%s)' % ( | ||
MIN_HOTDOC_VERSION, d)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[F821] undefined name 'd'
mesonbuild/modules/hotdoc.py
Outdated
return value | ||
|
||
return os.path.relpath(os.path.join(state.environment.get_source_dir(), value), | ||
state.environment.get_build_dir()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[E128] continuation line under-indented for visual indent
mesonbuild/modules/hotdoc.py
Outdated
raise MesonException('hotdoc executable not found') | ||
|
||
try: | ||
from hotdoc.run_hotdoc import run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[F401] 'hotdoc.run_hotdoc.run' imported but unused
mesonbuild/modules/hotdoc.py
Outdated
' required for the project name.') | ||
|
||
project_name = args[0] | ||
def file_to_path(value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[E306] expected 1 blank line before a nested definition, found 0
|
||
|
||
def initialize(interpreter): | ||
return HotDocModule(interpreter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[W292] no newline at end of file
@jpakkane Could you please rebuild your CI docker image with the changes from that PR ? |
@@ -0,0 +1,9 @@ | |||
project('hotdoc', 'c') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably specify a version here, then use meson.project_version() in generate_doc()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want that to be automatic if project_version
is not specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea, but it might lead to confusing bugs in practice, as most projects would want to use the major version here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I have started a rebuild of the CI image. It should be uploaded in about an hour. In the future please don't fiddle with the travis files, but change the master Dockerfile under |
705724b
to
5b73a0d
Compare
mesonbuild/modules/hotdoc.py
Outdated
@@ -0,0 +1,317 @@ | |||
import os | |||
import subprocess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[F401] 'subprocess' imported but unused
The AppVeyor failure looks weird and is totally unrelated I believe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This otherwise looks ok to me, good job :)
MIN_HOTDOC_VERSION = '0.8.100' | ||
|
||
|
||
class HotdocTargetBuilder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, this builder object is simply used to hold intermediary state while processing the arguments, which is why it's separate from the actual target classes, and why you don't simply have a huge function in the module to prepare the targets. That makes sense to me, but I would suggest following that approach to its end, and simply have something like:
builder = Builder()
targets = builder.make_targets()
in the generate_doc()
method of the module, makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I started having a generic Builder that could be reused in other modules, but that experiment didn't work well, let do what you suggest, it will be cleaner :-)
@thiblahute , you will also need to add documentation, and a release snippet |
The module might need to add extra methods on the returned targets and thus it can return TargetHolders, we should process the held targets
Added documentation and made the small refactoring @MathieuDuponchelle asked for. |
We obviously will need @jpakkane 's approval, but this looks good to go to me now :) |
The sources argument seems to only handle strings. Should it work with files objects as well? I would imagine people wanting to do something like: sources = files(...)
shared_library('something', sources)
hotdoc.generate_doc(...
c_sources : files,
...
) To only have to list the files once? |
Let's eat our own dogfood.
Thanks :-) |
Hi Thibault. It's not very intuitive to have to invoke It's also strange that a bare I'd like to make this better but right now I'm completely lost in these inconsistencies. Care to shed some light? PS: all the above observed with today's master branch at commit be9bff8 |
It doesn't build the doc by default unless you specify it when you declare the target, it is build only when installing or when invoking the |
Hi Thibault, I think I figured out why we were talking across each other. I should have written that I'm very specifically referring to building the documentation of meson itself and your commit 6f72473b2457ecd4, and especially this line of yours:
|
Ah, I just ported previous doc there (where it was explaining how to upload the doc), you can just run |
|
but I don't think this is used by the hotdoc module. |
It does and it worked at some point, we should check why it doesn't anymore. |
Oh, good to know, then yeah that would be the thing to check first :) |
@MathieuDuponchelle @thiblahute : While you're here, would you guys agree to add yourself in CODEOWNERS for the hotdoc module? |
I guess I am fine with that, what does it involve in practice? |
You get requested review automatically for any PR that touch that module. More generally, you are the maintainer of that module, you take the decisions about new features, etc that gets included. I've been pushing to delegate more responsibilities in the Meson project: #6485. |
I am fine with that. |
that is a good idea yes :) thib knows more about the module than I do however |
While I have admittedly no idea why it works,
Depending on the complexity this may be overkill for |
Sure, but if the goal is to simply rebuild the local copy, then there's not much point in trying to upload to a place where you probably don't have write access :D
Right, but meson needs some trigger to make it rebuild when some dep has changed doesn't it? |
Let me quote the very first sentence I used to start this recent discussion:
Back to you:
I meant: no, in this very particular case it could just rebuild every time because it's quick. Like |
Yes? My point is that ninja upload isn't the correct command to use to rebuild the doc locally, I gave you the correct one and you replied something about conciseness, I don't really get your point now
|
OK, here is the fix in meson: hotdoc/hotdoc#184 Although I add this issue with ninja 1.9 which is fixed in ninja 1.10. |
Involving I will try the fix, thanks Thibault. |
It's the correct way if you want to rebuild from scratch, using the |
Agreed, keeping in mind rebuilding from scratch is a workaround in the first place. Unless changes are made to the See also "meson + ninja wrapper script" comment here: #6434 (comment) tl;dr: using
Agreed, as in: " is bad better than very bad?" |
Good news is with thib's fix the behaviour is correct again so we can forget about the argument :D |
If meson's builtin support for reconfiguring on changes to meson.build isn't enough for you (why not???) then I would recommend using |
I thought I was trying the fix yesterday but realized at last the fix is in hotdoc itself and not in the meson module and that the fixed hotdoc version isn't released in pip yet :-/ Will try again another time.
It is enough... most but not all the time. When changing cross files maybe? I'm actually amazed it is enough most of the time, however my project is small enough that it's just faster to
I tried |
hotdoc: http://github.com/hotdoc/hotdoc/