Skip to content

PythonPackage code for make_module_extra looks suspicious #2708

@akesandgren

Description

@akesandgren

This code from pythonpackage,.py looks wrong:

    def make_module_extra(self, *args, **kwargs):
        """Add install path to PYTHONPATH"""
        txt = ''

        # update $EBPYTHONPREFIXES rather than $PYTHONPATH
        # if this Python package was installed for multiple Python versions
        if self.multi_python:
            txt += self.module_generator.prepend_paths(EBPYTHONPREFIXES, '')
        elif self.require_python:
            self.set_pylibdirs()
            for path in self.all_pylibdirs:
                fullpath = os.path.join(self.installdir, path)
                # only extend $PYTHONPATH with existing, non-empty directories
                if os.path.exists(fullpath) and os.listdir(fullpath):
                    txt += self.module_generator.prepend_paths('PYTHONPATH', path)

        return super(PythonPackage, self).make_module_extra(txt, *args, **kwargs)

make_module_extra does not take a txt argument, not in ExtensionEasyBlock nor in EasyBlock, it only returns a txt argument.
So the correct order should be to do:

txt = super(PythonPackage, self).make_module_extra(*args, **kwargs)

txt += ....

return txt

as it is done in most easyblocks that use make_module_extra

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions