[Python] How to find absolute path in Scons site_tools

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I'm running into problems with the difference in environment between SConscripts and custom tools under site_tools.

    I'm trying to find the absolute path of a string, which is fine in SConscript:

    print File('#something').get_abspath()
    >> /home/projects/something


    Similar code in site_tools:

    from SCons.Node.FS import File
    print File('#something').get_abspath()
    >> TypeError: __init__() takes exactly 4 arguments (2 given)


    So clearly the File() constructed in SConscript is not a SCons.Node.FS.File.

    So the questions are:

    1) What is the File object in a SConscript, and how can I get one in a builder/site_tools?

    2) How can I get the absolute path in site_tools? I need this because I'm constructing command-line arguments for tools which need absolute paths.

    Continue reading...

Compartilhe esta Página