Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonPackage code for make_module_extra looks suspicious #2708

Open
akesandgren opened this issue Apr 1, 2022 · 0 comments
Open

PythonPackage code for make_module_extra looks suspicious #2708

akesandgren opened this issue Apr 1, 2022 · 0 comments

Comments

@akesandgren
Copy link
Contributor

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

@boegel boegel changed the title pythonpackage code for make_module_extra looks suspicious PythonPackage code for make_module_extra looks suspicious Apr 27, 2022
@boegel boegel added this to the next release (4.5.5?) milestone Apr 27, 2022
@boegel boegel modified the milestones: 4.5.5, release after 4.5.5 Jun 4, 2022
@boegel boegel modified the milestones: 4.7.3, release after 4.7.3 Jul 6, 2023
@boegel boegel modified the milestones: 4.9.1, release after 4.9.1 Apr 3, 2024
@boegel boegel modified the milestones: 4.9.2, release after 4.9.2 Jun 6, 2024
@boegel boegel removed this from the 4.9.3 milestone Sep 11, 2024
@boegel boegel added this to the release after 4.9.3 milestone Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants