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

[python_requires] objects are overwritten when using multiple python_requires calls in one recipe #3619

Closed
3 tasks done
Verenchen opened this issue Sep 26, 2018 · 3 comments · Fixed by #3628
Closed
3 tasks done
Assignees
Milestone

Comments

@Verenchen
Copy link

To help us debug your issue please explain:

  • I've read the CONTRIBUTING guide.
  • I've specified the Conan version, operating system version and any tool that can be relevant.
  • I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

conan version: 1.7.4
os: Windows 7
Python 3.6.5

We are using multiple python_requires calls in our recipes. It seems that a second python_requires call overwrites objects of the previous python_requires call.
Given the following two python modules:
module1
module2

If I import both modules via the python_reuqires I would expect the follwing behavior:
expectedbehavior

But the behavior is the following:
currentbehavior1
So the second python_requires overwrites the function and the variable from the first python_requires:
currentbehavior

This seems a bit confusing to us.
Can you please have a look at this?

Thanks!

@ahauan4
Copy link

ahauan4 commented Sep 26, 2018

I think we have the same problem here.
We want to define a list of packages in a Python module which we want to import into our recipe via 'python_requires'. The Python module defines a global variable called 'packages'.
It works as long as we only import one module, but as soon as we import a second one with the same variable 'packages' defined, the variable of the first module gets overwritten.
Maybe you can distinguish the modules internally by giving each one internally a different hash?

@jgsogo
Copy link
Contributor

jgsogo commented Sep 26, 2018

I think it can be improved by assigning a different name to each loaded module, almost the same behavior implemented for the plugins functionality in these lines.

Thanks for reporting.

@jgsogo jgsogo added this to the 1.9 milestone Sep 26, 2018
@lasote lasote modified the milestones: 1.9, 1.8 Sep 26, 2018
@lasote
Copy link
Contributor

lasote commented Sep 26, 2018

Let's try to fix it for 1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants