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

fix python traceback when gtkdoc needs an exe_wrapper but doesn't have one #9841

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

eli-schwartz
Copy link
Member

In commit c88bfdb we added support for an exe_wrapper to gtkdoc, which checked twice whether the environment says it is needed, and didn't check at all whether one was provided.

The result:

  File "/usr/lib/python3/dist-packages/mesonbuild/modules/gnome.py", line 1354, in gtkdoc
    t_args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command()))
AttributeError: 'NoneType' object has no attribute 'get_command'

Instead, check whether we have a valid exe_wrapper (if we don't need one, then even when one is defined in the cross file, we get an EmptyExternalProgram) and if we do, use it.

If we don't have one, but need one, then we revert back to the behavior before commit c88bfdb, which probably means "executing the doc target causes the command to error out with "Exec format error".

@eli-schwartz
Copy link
Member Author

eli-schwartz commented Jan 18, 2022

Reported in IRC by Helmut Grohne. Untested, because I don't have the necessary environment.

Maybe we should raise a MesonException here instead?

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #9841 (266e8ac) into master (eafb8a8) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9841      +/-   ##
==========================================
- Coverage   66.51%   66.51%   -0.01%     
==========================================
  Files         402      402              
  Lines       85698    85700       +2     
  Branches    18920    18920              
==========================================
+ Hits        57000    57001       +1     
- Misses      24294    24295       +1     
  Partials     4404     4404              
Impacted Files Coverage Δ
mesonbuild/modules/gnome.py 78.44% <33.33%> (+0.02%) ⬆️
mesonbuild/scripts/vcstagger.py 87.50% <0.00%> (-4.17%) ⬇️
modules/gnome.py 78.06% <0.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eafb8a8...266e8ac. Read the comment docs.

@eli-schwartz
Copy link
Member Author

Confirmation from IRC that this patch causes the build to complete successfully, gtkdoc and all? Interesting.

@eli-schwartz
Copy link
Member Author

eli-schwartz commented Jan 18, 2022

@ericonr @kanavin

This shouldn't affect your use cases, but wanted to give a heads up.

t_args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command()))
# if not need_exe_wrapper, we get an EmptyExternalProgram. If none provided, we get NoneType
exe_wrapper = state.environment.get_exe_wrapper()
if not isinstance(exe_wrapper, (NoneType, EmptyExternalProgram)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be if exe_wrapper and exe_wrapper.found():

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it cannot, because an EmptyExternalProgram will exist (not NoneType) and is found, it just evaluates to self.command = [].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the heck is an EmptyExternalProgram and why do we have it? sigh

xtkoba added a commit to termux/termux-packages that referenced this pull request Feb 15, 2022
…e one

In commit c88bfdb we added support for
an exe_wrapper to gtkdoc, which checked twice whether the environment
says it is needed, and didn't check at all whether one was provided.

The result:

  File "/usr/lib/python3/dist-packages/mesonbuild/modules/gnome.py", line 1354, in gtkdoc
    t_args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command()))
AttributeError: 'NoneType' object has no attribute 'get_command'

Instead, check whether we have a valid exe_wrapper (if we don't need
one, then even when one is defined in the cross file, we get an
EmptyExternalProgram) and if we do, use it.

If we don't have one, but need one, then we revert back to the behavior
before commit c88bfdb, which probably
means "executing the doc target causes the command to error out with
"Exec format error".
@eli-schwartz eli-schwartz merged commit 266e8ac into mesonbuild:master Mar 9, 2022
@eli-schwartz eli-schwartz deleted the gtkdoc-nowrapper branch March 9, 2022 22:48
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 this pull request may close these issues.

None yet

2 participants