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

gnome.generate_gir: allow to specify python executable #4973

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nachogarglez
Copy link
Contributor

@nachogarglez nachogarglez commented Feb 24, 2019

Adds a new parameter to generate_gir function in gnome
module, to allow specifying which python executable will
be used during the invocation to g-ir-scanner

This is necessary in some cases, for example pygobject
tests will generate a module for the default python
command, and they will fail if g-object-instrospection was
configured with other python version.

if kwargs.get('python_executable'):
python_cmd = ExternalProgram(kwargs.get('python_executable'))
giscanner_py = giscanner.held_object.get_path()
giscanner.held_object.command = [python_cmd.get_path(),giscanner_py]
Copy link
Member

@ignatenkobrain ignatenkobrain Feb 24, 2019

Choose a reason for hiding this comment

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

[Flake8] [E231] missing whitespace after ','

posted by Sider

@nachogarglez nachogarglez force-pushed the add-python_executable-option-to-generate-gir branch from a9382f9 to efaeaad Compare Feb 24, 2019
@nachogarglez nachogarglez force-pushed the add-python_executable-option-to-generate-gir branch 2 times, most recently from 12a38bd to 900002b Compare Mar 17, 2019
@jpakkane
Copy link
Member

@jpakkane jpakkane commented Mar 28, 2019

This seems to only work if python_executable is a string, it should also accept an ExternalProgram.

Documentation needs to be updated as well as adding a release note snippet as this is new functionality.

Changing the guts of an existing ExternalProgram is suspicious. It should instead produce a completely new object with something like:

python_program = <ExternalProgram for Python>
giscanner = ExternalProgram(python_program.command + giscanner.command, silent=True)

@jpakkane
Copy link
Member

@jpakkane jpakkane commented Apr 21, 2019

ping

@jpakkane
Copy link
Member

@jpakkane jpakkane commented May 15, 2019

Ping again.

@dcbaker
Copy link
Member

@dcbaker dcbaker commented May 16, 2019

Is this really portable? it seems like each user would need to modify the build scripts so that it points at the correct python version on their system, right?

Adds a new parameter to generate_gir function in gnome
module, to allow specifying which python executable will
be used during the invocation to g-ir-scanner

This is necessary in some cases, for example pygobject
tests will generate a module for the default python
command, and they will fail if g-object-instrospection was
configured with other python version.
@nachogarglez nachogarglez force-pushed the add-python_executable-option-to-generate-gir branch from 900002b to eee9088 Compare Nov 3, 2019
@nachogarglez
Copy link
Contributor Author

@nachogarglez nachogarglez commented Nov 3, 2019

Is this really portable? it seems like each user would need to modify the build scripts so that it points at the correct python version on their system, right?

Normally, you don't have to specify anything. But there are some corner cases when you need to generate python bindings with a different python version that the one being used by meson itself. Specially if that python version is older than the minimum required by Meson.

@nachogarglez
Copy link
Contributor Author

@nachogarglez nachogarglez commented Nov 3, 2019

This seems to only work if python_executable is a string, it should also accept an ExternalProgram.

Documentation needs to be updated as well as adding a release note snippet as this is new functionality.

Changing the guts of an existing ExternalProgram is suspicious. It should instead produce a completely new object with something like:

python_program = <ExternalProgram for Python>
giscanner = ExternalProgram(python_program.command + giscanner.command, silent=True)

Sorry I totally lost the context for this patch. I have done my best with this and submitted a fix. Also I updated the documentation, as required.

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

4 participants