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 with alias #3957

Merged
merged 9 commits into from Dec 3, 2018
Merged

python requires with alias #3957

merged 9 commits into from Dec 3, 2018

Conversation

@jgsogo
Copy link
Member

@jgsogo jgsogo commented Nov 19, 2018

Changelog: Fix: Resolve aliased packages in python_requires

  • closes #3920
  • add test: alias with alias
  • add test: alias with python_requires
  • closes #4011 through jgsogo#7
@jgsogo jgsogo requested a review from memsharded Nov 19, 2018
@ghost ghost assigned jgsogo Nov 19, 2018
@ghost ghost added the stage: review label Nov 19, 2018
module, filename = parse_conanfile(path)

# Check for alias
conanfile = parse_module(module, filename)
Copy link
Member Author

@jgsogo jgsogo Nov 19, 2018

I would want to use here the ConanFileLoader class, but it requires a python_requires member (and it is where I am!), see instantiation in conan_api.py here:

        python_requires = ConanPythonRequire(self._proxy, resolver)
        self._loader = ConanFileLoader(self._runner, self._user_io.out, python_requires)

Copy link
Member

@memsharded memsharded Nov 19, 2018

I think I'll prefer to really have an injected loader object into PythonRequires (yes, runtime cycle between objects).
We could make ConanFileLoader be the one that really instantiates PythonRequires object, passing a referent to itself to it.

This can't go to 1.9.2, a bit risky in my opinion.

@lasote lasote added this to the 1.10 milestone Nov 19, 2018
@lasote lasote assigned memsharded and unassigned lasote Nov 19, 2018
Copy link
Member

@memsharded memsharded left a comment

As commented previously, I think this needs architectural changes.

I think I'll prefer to really have an injected loader object into PythonRequires (yes, runtime cycle between objects).We could make ConanFileLoader be the one that really instantiates PythonRequires object, passing a referent to itself to it.

@jgsogo
Copy link
Member Author

@jgsogo jgsogo commented Nov 26, 2018

I'm having a look at this again, and it is not immediate. python_requires needs the module at the conanfile path, not the ConanFile class itself, and the loader doesn't retrieve the module. So it is not just a cosmetic change (and the runtime cyclic dependency), it requires modifying the API of the loader.

I think it is worth a different architectural PR, maybe creating the ConanPythonRequire inside ConanFileLoader as you said, but then we need to think why the first one needs the proxy, client_cache, remote_manager and registry... I think those are too many members to be inside the loader.

@jgsogo jgsogo dismissed memsharded’s stale review Dec 3, 2018

Please, review again (and consider merging)

@memsharded memsharded merged commit fee5ca2 into conan-io:develop Dec 3, 2018
2 checks passed
@ghost ghost removed the stage: review label Dec 3, 2018
grisumbras pushed a commit to grisumbras/conan that referenced this issue Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants