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

Custom recipes don't add the .a to the XCode project #642

Open
meow464 opened this issue Sep 23, 2021 · 3 comments
Open

Custom recipes don't add the .a to the XCode project #642

meow464 opened this issue Sep 23, 2021 · 3 comments

Comments

@meow464
Copy link
Contributor

meow464 commented Sep 23, 2021

Versions

  • Python : 3.7.12 and 3.8.2
  • MacOS version : Big Sur and Catalina
  • XCode Version : 12.4 and12.5.1
  • Cython version : 0.29.24

We were able to test on those versions but it probably affects any version.

Describe the bug
toolchain build myrecipe --add-custom-recipe /path/to/myrecipe builds the recipe correctly but doesn't add the .a file to the XCode project. If you drag and drop it under Frameworks then everything just works.

To Reproduce
toolchain build myrecipe --add-custom-recipe /path/to/myrecipe You can use this simple recipe to test it. It's a simple Cython recipe that queries the iOS version.

Expected behavior
The .a file should be automatically added under the Frameworks folder in the XCode project.

Logs

2021-09-23 14:41:06.652066-0700 myapp[46351:3595957] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2021-09-23 14:41:06.652426-0700 myapp[46351:3595957] Initializing python
2021-09-23 14:41:06.811536-0700 myapp[46351:3595957] Running main.py: /Users/tuco/Library/Developer/CoreSimulator/Devices/E34D8146-ED7A-4771-AAFE-02C4FC26464B/data/Containers/Bundle/Application/159F0B96-3B8A-4704\
-A5F1-765E7664D138/myapp.app/YourApp/main.pyc
Traceback (most recent call last):
  File "/Users/tuco/Projects/ios_recipes/myapp/.buildozer/ios/platform/kivy-ios/myapp-ios/YourApp/main.py", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_myrecipe)
2021-09-23 14:41:06.814412-0700 myapp[46351:3595957] Application quit abnormally!
2021-09-23 14:41:06.819038-0700 myapp[46351:3595957] Leaving
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 25, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
@meow464
Copy link
Contributor Author

meow464 commented Sep 25, 2021

The .a files are added by the update_pbxproj() function

    for recipe in Recipe.list_recipes():
        # Some code here
        pbx_frameworks.extend(recipe.pbx_frameworks)
        pbx_libraries.extend(recipe.pbx_libraries)
        libraries.extend(recipe.dist_libraries)
        frameworks.extend(recipe.frameworks)

The called function list_recipes():

    def list_recipes(cls, **kwargs):
        skip_list = kwargs.pop("skip_list", ['__pycache__'])
        recipes_dir = join(dirname(__file__), "recipes")
        for name in sorted(listdir(recipes_dir)):
            fn = join(recipes_dir, name)
            if isdir(fn) and name not in skip_list:
                yield name

As you can see, the list_recipes() function reads the recipes directly form kivy_ios/recipes and completely ignores any --add-custom-recipe argument that might have been passed.

Solution: The update command already accepts a --add-framework parameters, might as well accept --add-custom-recipe. Now the user needs to run: toolchain build myrecipe --add-custom-recipe /path/to/myrecipe AND toolchain update xcodeproj myrecipe --add-custom-recipe /path/to/myrecipe.

I will make a pull request.

meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 25, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 25, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 25, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 25, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 26, 2021
# This is the 1st commit message:

Adds `--add-custom-recipe` to `update` and `create` commands

Custom recipes were built but not added to the XCode project.
See: kivy#642

# This is the commit message kivy#2:

adds custom recipe support to the create command
meow464 added a commit to meow464/kivy-ios that referenced this issue Sep 26, 2021
Custom recipes were built but not added to the XCode project.
See: kivy#642
@meow464
Copy link
Contributor Author

meow464 commented Sep 27, 2021

Pull request

@tcaduser
Copy link
Contributor

it doesn't look like this was ever accepted, because I still find myself copying my recipe manually into the kivy_ios module:

$VIRTUAL_ENV/lib/python3.9/site-packages/kivy_ios/recipes/myapp/__init__.py

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

No branches or pull requests

2 participants