Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-4953

Please eliminate misleading warning when running scons on OSX with SIP

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: base, sconsUtils
    • Labels:
      None
    • Story Points:
      0.25
    • Team:
      SQuaRE

      Description

      On a Mac with OSX 10.11 and SIP enabled, every time I run scons on an LSST package I get the message:

      $ scons
      scons: Reading SConscript files ...
      Could not import lsstcppimport; please ensure the base package has been built (not just setup).
       
      EUPS integration: enabled
      [etc]
      

      It's not fatal, and is not indicative of a fundamental problem. But it is alarming, especially for new users who will assume this means something has broken when they first hit this message. (I did.)

        Attachments

          Activity

          Hide
          tjenness Tim Jenness added a comment -

          This message comes from code in the lsstimport module. This module is loaded in every single _init.py file in the lsst hierarchy and so is loaded by every Python process that attempts to import a package as import lsst.xxx. sconsUtils has a version of init_.py that doesn't care if lsstimport can not be imported, which is fine for the very first package that is being built but is irrelevant once base is installed. When scons imports an LSST package lsstimport can be found but lsstcppimport can not be loaded because the library load path environment variables have been stripped. sconsUtils does not care about that because sconsUtils does not need any LSST packages other than sconsUtils to load.

          There are a number of options here:

          • Disable the print message in lsstimport.
          • Try to introspect enough to determine that scons is loading lsstimport and do not warn.
          • Move sconsUtils outside the LSST namespace and just call it something like lsstsconsUtils.

          The fundamental problem is that Python 2 module namespaces are broken since they always require a _init_.py file in the root namespace.

          Show
          tjenness Tim Jenness added a comment - This message comes from code in the lsstimport module. This module is loaded in every single _ init .py file in the lsst hierarchy and so is loaded by every Python process that attempts to import a package as import lsst.xxx . sconsUtils has a version of init _.py that doesn't care if lsstimport can not be imported, which is fine for the very first package that is being built but is irrelevant once base is installed. When scons imports an LSST package lsstimport can be found but lsstcppimport can not be loaded because the library load path environment variables have been stripped. sconsUtils does not care about that because sconsUtils does not need any LSST packages other than sconsUtils to load. There are a number of options here: Disable the print message in lsstimport . Try to introspect enough to determine that scons is loading lsstimport and do not warn. Move sconsUtils outside the LSST namespace and just call it something like lsstsconsUtils . The fundamental problem is that Python 2 module namespaces are broken since they always require a _ init _.py file in the root namespace.
          Hide
          tjenness Tim Jenness added a comment -

          You will also get this warning from scons when you are running a Python 3 stack because scons will not be able to import and lsst packages when scons is being executed with python 2.

          Show
          tjenness Tim Jenness added a comment - You will also get this warning from scons when you are running a Python 3 stack because scons will not be able to import and lsst packages when scons is being executed with python 2.
          Hide
          rhl Robert Lupton added a comment -

          It doesn't sound as if the introspection would be hard (would looking for LSST_LD_LIBRARY_PATH be enough?)

          Show
          rhl Robert Lupton added a comment - It doesn't sound as if the introspection would be hard (would looking for LSST_LD_LIBRARY_PATH be enough?)
          Hide
          tjenness Tim Jenness added a comment -

          I think you can probably see if Scons packages have been imported.

          Show
          tjenness Tim Jenness added a comment - I think you can probably see if Scons packages have been imported.
          Hide
          wmwood-vasey Michael Wood-Vasey [X] (Inactive) added a comment -

          I added a check to try to import SCons.Script if we can't import lsstcppimport. If we can import SCons.Script then we're in scons and we should worry about the failed import. If not, then still print out the warning.

          The Jenkins job is #25718:

          https://ci.lsst.codes/job/stack-os-matrix/25718

          Show
          wmwood-vasey Michael Wood-Vasey [X] (Inactive) added a comment - I added a check to try to import SCons.Script if we can't import lsstcppimport . If we can import SCons.Script then we're in scons and we should worry about the failed import. If not, then still print out the warning. The Jenkins job is #25718: https://ci.lsst.codes/job/stack-os-matrix/25718
          Hide
          tjenness Tim Jenness added a comment -

          Looks fine to me. This is the technique sconsUtils uses to work out whether it has been imported in a SCons environment or not.

          Show
          tjenness Tim Jenness added a comment - Looks fine to me. This is the technique sconsUtils uses to work out whether it has been imported in a SCons environment or not.
          Hide
          wmwood-vasey Michael Wood-Vasey [X] (Inactive) added a comment -

          Merged to master.

          Show
          wmwood-vasey Michael Wood-Vasey [X] (Inactive) added a comment - Merged to master.

            People

            Assignee:
            wmwood-vasey Michael Wood-Vasey [X] (Inactive)
            Reporter:
            swinbank John Swinbank
            Reviewers:
            Tim Jenness
            Watchers:
            John Swinbank, Joshua Hoblitt, Joshua Meyers, Maria Patterson [X] (Inactive), Michael Wood-Vasey [X] (Inactive), Robert Lupton, Tim Jenness
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.