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

Conversation

Projects
None yet
3 participants
@jgsogo
Copy link
Member

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

lasote and others added some commits Nov 8, 2018

@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)

This comment has been minimized.

Copy link
@jgsogo

jgsogo Nov 19, 2018

Author Member

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)

This comment has been minimized.

Copy link
@memsharded

memsharded Nov 19, 2018

Contributor

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

@memsharded
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

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 added some commits Nov 27, 2018

Feature/fix py requires alias (#7)
* fix python_requires recursive alias

* context to make it cleaner

* fix tests

* unify load_class/module

* remove imports

* improved parse_conanfile

Please, review again (and consider merging)

@memsharded memsharded merged commit fee5ca2 into conan-io:develop Dec 3, 2018

2 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details

@ghost ghost removed the stage: review label Dec 3, 2018

grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.