Conan: Defaults for conan_api.create

Created on 31 Aug 2017  路  3Comments  路  Source: conan-io/conan

Hi,
I was trying out the conan_api that you guys added recently and I think I found a bug.
(I am using 0.25.1)

When doing the following:

conan = conan_api.Conan.factory()
conan.create(profile_name=args.profile, user=args.user, channel=args.channel, build='missing', cwd=args.path)

I get this output:

Traceback (most recent call last):
  File "./uploadRecipe.py", line 93, in <module>
    conan.create(profile_name=args.profile, user=args.user, channel=args.channel, build='missing', cwd=args.recipe)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 56, in wrapper
    return f(*args, **kwargs)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 288, in create
    manifests = _parse_manifests_arguments(verify, manifests, manifests_interactive, cwd)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 656, in _parse_manifests_arguments
    raise ConanException("Do not specify both manifests and "
conans.errors.ConanException: Do not specify both manifests and manifests-interactive arguments

So I tried to set manifests_interactive, verify and manifests. to None or to '' then I get:

Traceback (most recent call last):
  File "./uploadRecipe.py", line 95, in <module>
    manifests_interactive=None, verify=None, manifests=None)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 56, in wrapper
    return f(*args, **kwargs)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 300, in create
    update=update
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/manager.py", line 299, in install
    build_mode = BuildMode(build_modes, self._user_io.out)
  File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/installer.py", line 63, in __init__
    assert isinstance(params, list)
AssertionError

I guess because I am not setting the right defaults in order to get the arguments are ignored :smile:

So far I am using the following workaround:

outputer = CommandOutputer(conan._user_io, conan._client_cache)
command = Command(conan, conan._client_cache, conan._user_io, outputer)
command.create(arguments) #where arguments is an array 

Thanks for your time

bug

All 3 comments

I think your second version is closer, it solved the errors with the manifest parameters, but the thing is that the build argument should be an array. Try something like:

conan.create(profile_name=args.profile, user=args.user, channel=args.channel, build=['missing'], cwd=args.path, manifests_interactive=None, verify=None, manifests=None)

I agree this is a bug in the API, the defaults should be improved, thanks for reporting!

Yep that worked, thanks! :smile:
I should have noticed the build_mode in the stacktrace

Also since it is an easy fix I would be happy to try to fix it.

Good! You might try to run the tests locally after doing changes, though we also have CI setup. Just ask if you need help. Thanks!

Was this page helpful?
0 / 5 - 0 ratings