[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 09:04:05 EDT 2022


Hi Scons people,


So I'm trying to build rmlint https://github.com/sahib/rmlint
It worked normally on Python 3.9, but since 3.10 and 3.11, I can't install it in the 
location I want.

In the SConstruct file we have
```
AddOption(
      '--prefix', default='/usr/local',
      dest='prefix', type='string', nargs=1,
      action='store', metavar='DIR', help='installation prefix'
)
```

which I set to /usr instead of /usr/local with `scons config --prefix=/usr`

It works and the scons config does show it has been set to /usr in the summary.

It works for the top level binary which is installed in /usr/bin/rmlint

But then we have the gui/SConscript file which defines:

```
          py_install = env.Command(
              'always.install',
              ['setup.py'],
              'cd gui && python3 setup.py install --prefix {} --record .files.txt'.format(
                  GetOption('prefix')
              )
          )
```

But here the GetOption('prefix') is replaced with the default /usr/local and not the /usr I 
set up with scons config.


**Required information**
* Version of SCons 4.3.0
* Version of Python 3.10 and 3.11, 3.9 works
* Which python distribution if applicable: Fedora package
* How you installed SCons: Fedora package
* What Platform are you on? Fedora Linux 36 and Rawhide
* How you invoke scons (The command line you're using "scons --flags some_arguments")

`scons config -m 16  --prefix=/usr --actual-prefix=/usr --libdir=lib64 DEBUG=1 SYMBOLS=1 
VERBOSE=1`

* How to reproduce your issue?  Please include a small self contained reproducer. Likely a 
SConstruct should do for most issues.

Then I get:
```
rmlint will be compiled with the following features:

      Find non-stripped binaries (needs libelf)             : yes
      Optimize using ioctl(FS_IOC_FIEMAP) (needs linux)     : yes
      Support for SHA512 (needs glib >= 2.31)               : yes
      Build manpage from docs/rmlint.1.rst                  : no
      Support for caching checksums in file's xattr         : yes
      Support for reading json caches (needs json-glib)     : yes
      Checking for proper support of big files >= 4GB       : yes
          (needs either sizeof(off_t) >= 8 ...)             : yes
          (... or presence of stat64)                       : yes

      Optimize non-rotational disks                         : yes
          (needs libblkid for resolving dev_t to path)      : yes
          (needs gio-unix-2.0)                              : yes

      Enable gettext localization                           : yes
          (needs <locale.h> for compile side support)       : yes
          (needs msgfmt to compile .po files)               : yes

The following constants will be used during the build:

      Version information  : 2.10.1 "Ludicrous Lemur" (rev e237cd1)
      Compiler             : gcc
      Install prefix       : /usr
      Actual prefix        : /usr
      Verbose building     : yes
      Adding debug checks  : yes
      Adding debug symbols : yes

Type 'scons' to actually compile rmlint now. Good luck.
```

-> Set prefix directory is actually recognized

`
scons`

-> Builds correctly.

`scons install`

-> Install the gui sublibrary in the weong place (/usr/local instead of /usr/)

See a build log here: https://koji.fedoraproject.org/koji/taskinfo?taskID=88548801

Any input please?

Best regards,

Robert-André Mauchin



More information about the Scons-users mailing list