[Scons-users] Regression? GetOption('prefix') does not seem to work in SConscript files since Python 3.10

Robert-André Mauchin zebob.m at gmail.com
Tue Jun 21 11:35:18 EDT 2022


On 6/21/22 17:16, Robert-André Mauchin wrote:
> 
> Well, none of this is actually the problem but according to my Python master, it is due to 
> change in Fedora about how it handles Python installations:
> 
> ================================================================================================ 
> 
> RPM build–related caveats
> 
> When Python runs during RPM build, it selects the rpm_prefix installation scheme. This 
> behavior is triggered when the $RPM_BUILD_ROOT environment variable is set. That has several 
> caveats:
> Executing Python in Python’s subprocess
> 
> If the Python code that runs in RPM build (for example in %check) executes another Python 
> instance via a subprocess, it is relatively easy to inadvertently unset all environment 
> variables. When this happens, the inner Python will not know it runs within RPM build and 
> will return paths with the /local/ infix.
> ================================================================================================ 
> 
> 
> So the problem is not SCons itself, however I need:
> 
> ```
> if 'install' in COMMAND_LINE_TARGETS and GetOption('with_gui'):
>      if not which('python3'):
>          print('!! Unable to find python3 executable.')
>          print('!! Will build no GUI.')
>      else:
>          py_install = env.Command(
>              'always.install',
>              ['setup.py'],
>              'cd gui && python3 -m install . --prefix {}'.format(
>                  GetOption('prefix')
>              )
>          )
>          env.Alias('install', py_install)
> ```
> 
> to be able to pass an environment variable to the Python subprocess via env.Command.
> 
> Any idea how to do that?
> 
> Thanks!
> 
> Best regards,
> 
> Robert-André

Thanks for the help, I just read the f****** manual:
https://scons.org/doc/production/HTML/scons-user.html#idm46358270378320

Best regards,

Robert-André


More information about the Scons-users mailing list