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

enhance Cargo constructor to avoid processing list of crates multiple times into sources #2934

Merged
merged 2 commits into from
May 24, 2023

Conversation

boegel
Copy link
Member

@boegel boegel commented May 24, 2023

(created using eb --new-pr)

@boegel boegel force-pushed the 20230524165422_new_pr_cargo branch from ac4b2ed to 8c16623 Compare May 24, 2023 14:58
Micket
Micket previously approved these changes May 24, 2023
Copy link
Contributor

@Micket Micket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring the positive review from @Micket after fixing typo

@Micket Micket merged commit fa9b2c3 into easybuilders:develop May 24, 2023
@boegel boegel added this to the next release (4.7.2) milestone May 24, 2023
@boegel boegel added the bug fix label May 24, 2023
@boegel boegel deleted the 20230524165422_new_pr_cargo branch May 24, 2023 15:28
Flamefire added a commit to Flamefire/easybuild-easyblocks that referenced this pull request Aug 7, 2024
The issue intended to be fixed with easybuilders#2934 is actually cause by Pythons MRO:

CargoPythonPackage explicitely calls `__init__` of **both** `Cargo` and `PythonPackage`
1. `super().__init__` in Cargo calls `ExtensionEasyBlock->EasyBlock->Extension`
2. Then `PythonPackage.__init__` is called by `CargoPythonPackage`
3. `super().__init__` in PythonPackage calls `Cargo.__init__` again(!)
4. Then all other methods are called again as per 1.

The MRO order is
`[CargoPythonPackage, PythonPackage, Cargo, ExtensionEasyBlock, EasyBlock, Extension]`
which explains that.

Fix is to consistently use `super()` in the CargoPythonPackage inheritance chain.
Flamefire added a commit to Flamefire/easybuild-easyblocks that referenced this pull request Aug 7, 2024
The issue intended to be fixed with easybuilders#2934 is actually cause by Pythons MRO:

CargoPythonPackage explicitely calls `__init__` of **both** `Cargo` and `PythonPackage`
1. `super().__init__` in Cargo calls `ExtensionEasyBlock->EasyBlock` stop (Could then call `Extension` but `ExtensionEasyBlock does not use `super`)
2. Then `PythonPackage.__init__` is called by `CargoPythonPackage`
3. `super().__init__` in PythonPackage calls `Cargo.__init__` again(!)
4. Then all other methods are called again as per 1.

The MRO order is
`[CargoPythonPackage, PythonPackage, Cargo, ExtensionEasyBlock, EasyBlock, Extension]`
which explains that.

Fix is to consistently use `super()` in the CargoPythonPackage inheritance chain.
Flamefire added a commit to Flamefire/easybuild-easyblocks that referenced this pull request Aug 7, 2024
The issue intended to be fixed with easybuilders#2934 is actually caused by Pythons MRO:

CargoPythonPackage explicitely calls `__init__` of **both** `Cargo` and `PythonPackage`
1. `super().__init__` in Cargo calls `ExtensionEasyBlock->EasyBlock` stop (Could then call `Extension` but `ExtensionEasyBlock does not use `super`)
2. Then `PythonPackage.__init__` is called by `CargoPythonPackage`
3. `super().__init__` in PythonPackage calls `Cargo.__init__` again(!)
4. Then all other methods are called again as per 1.

The MRO order is
`[CargoPythonPackage, PythonPackage, Cargo, ExtensionEasyBlock, EasyBlock, Extension]`
which explains that.

Fix is to consistently use `super()` in the CargoPythonPackage inheritance chain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants