Skip to content

Expose Python Interpreter for rules and actions #453

@HDembinski

Description

@HDembinski

Make sure you completed the following tasks

Describe your use case

In the build of boost.histogram, I am running Python scripts to build the tests and documentation. Currently, I use actions with

/usr/bin/python3 my_python_script.py

This assumes that we are on Linux or MacOS, it won't work on Windows. I need the path of the Python interpreter.

The python module in B2 detects the path to the Python interpreter, but AFAIU, it does not provide a way for me to access that detected path.

Describe the solution you'd like

I want a way to access the Python interpreter that is found by the python module. Pseudocode:

import python ;

actions doxygen-postprocessing
{
    $(PYTHON_INTERPRETER) $(THIS_PATH)/doxygen_postprocessing.py "$(>)"
}

Or similar, I don't know how modules export path-constants.

Alternatives, if applicable

This is the brittle alternative is what we are currently using:

if [ os.name ] = NT
  {
    actions doxygen-postprocessing
    {
      python $(THIS_PATH)/doxygen_postprocessing.py "$(>)"
    }
  }
  else
  {
    actions doxygen-postprocessing
    {
      python3 $(THIS_PATH)/doxygen_postprocessing.py "$(>)"
    }
  }

Clearly, this is just a heuristic and begs to fail; detecting the interpreter is much more complicated than that and should be done by the code in the python module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions