Skip to content

[revamp] Recipes can only depend on other recipes #449

Closed

Description

@str4d

Reading the code, this appears to be intentional, but is there scope for allowing recipes to depend on modules? I am trying to write a Twisted recipe, and it depends on zope.interface, which is a trivial Python module that requires no special treatment. But currently I have to make a trivial recipe for it; I am wondering if that should be necessary. One reason for requiring a recipe is that then e.g. tests can be stripped out, but maybe that could be reliably automated for Python modules?

Activity

  1. inclement commented on Sep 12, 2015

    @inclement
    Member

    I should be possible to depend on anything in pypi (which will then be automatically downloaded and installed if it's a pure python module), if that doesn't work then it's a bug. Does adding the pypi module name in the depends not work?

  2. str4d commented on Sep 12, 2015

    @str4d
    ContributorAuthor

    The Python module is correctly detected in get_recipe_order_and_bootstrap() at line 2245, but then in the subsequent call to graph.remove_remaining_conflicts() it blows up:

    [INFO]:    Loaded recipe twisted (depends on ['zope.interface'])
    [INFO]:    No recipe named zope.interface; will attempt to install with pip
    Traceback (most recent call last):
      File "/home/str4d/.local/bin/p4a", line 11, in <module>
        sys.exit(ToolchainCL())
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 2428, in __init__
        getattr(self, args.command)(unknown)
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 169, in wrapper_func
        args = build_dist_from_args(ctx, dist, args)
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 2202, in build_dist_from_args
        build_order, python_modules, bs = get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 2262, in get_recipe_order_and_bootstrap
        graph.remove_remaining_conflicts(ctx)
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 481, in remove_remaining_conflicts
        recipe = Recipe.get_recipe(name, ctx)
      File "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 1774, in get_recipe
        mod = importlib.import_module("pythonforandroid.recipes.{}".format(name))
      File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
        __import__(name)
    ImportError: No module named zope.interface
    
  3. inclement commented on Sep 12, 2015

    @inclement
    Member

    Okay, I guess recipes haven't ever depended on pypi modules before, so
    it's a bug.

    On 12/09/15 12:24, str4d wrote:

    The Python module is correctly detected in
    |get_recipe_order_and_bootstrap()| at line 2245, but then in the
    subsequent call to |graph.remove_remaining_conflicts()| it blows up:

    |[INFO]: Loaded recipe twisted (depends on ['zope.interface']) [INFO]: No
    recipe named zope.interface; will attempt to install with pip Traceback
    (most recent call last): File "/home/str4d/.local/bin/p4a", line 11, in
    sys.exit(ToolchainCL()) File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 2428, in init getattr(self, args.command)(unknown) File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 169, in wrapper_func args = build_dist_from_args(ctx, dist, args)
    File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 2202, in build_dist_from_args build_order, python_modules, bs =
    get_recipe_order_and_bootstrap(ctx, dist.recipes, bs) File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 2262, in get_recipe_order_and_bootstrap
    graph.remove_remaining_conflicts(ctx) File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 481, in remove_remaining_conflicts recipe = Recipe.get_recipe(name,
    ctx) File
    "/home/str4d/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py",
    line 1774, in get_recipe mod =
    importlib.import_module("pythonforandroid.recipes.{}".format(name)) File
    "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
    import(name) ImportError: No module named zope.interface |

    —
    Reply to this email directly or view it on GitHub
    #449 (comment).

  4. inclement commented on Jan 10, 2016

    @inclement
    Member

    A method to resolve this was introduced by #559

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions