Re: Regression? GetOption('prefix') does not seem to work in SConscript files since Python 3.10

Robert-André Mauchin <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
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é
_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.