homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
300 stars 28 forks source link

Help wanted: Problem transitioning to Python3 #160

Closed homebysix closed 3 years ago

homebysix commented 4 years ago

Recipe Robot's transition to Python 3 has been delayed due to a problem with the way the Notifying* object types interact with the Swift UI app wrapper. The code at issue is on the 2.0.0-dev branch, and I would welcome another pair of eyes on it.

Requirements:

Steps to reproduce the behavior:

  1. Clone the repo locally and switch to the 2.0.0-dev branch.

  2. Run this command and note that it succeeds building recipes:

    ./scripts/recipe-robot --verbose --ignore-existing --app-mode https://coconut-flavour.com/updates/coconutBattery.xml
  3. Open ./app/Recipe Robot.xcodeproj in Xcode

  4. Build and run the app.

  5. Hold option to reveal the "Ignore existing" checkbox, and check it.

    Screen Shot 2020-05-02 at 11 10 01 AM

  6. Enter the same input URL as you provided to the command line tool: https://coconut-flavour.com/updates/coconutBattery.xml

  7. Click the Do It button and observe:

    Screen Shot 2020-05-02 at 11 00 15 AM

    • No progress messages are displayed
    • The run exits nonzero (as indicated by "Oops" message)

Expected behavior would be for the app output and the script output to match, given the same input.

I've traced the source of this error to the best of my (non pdb-savvy) ability, and it looks to be an issue with how the NotifyingList, NotifyingString, and other objects use NSDistributedNotificationCenter (e.g. https://github.com/homebysix/recipe-robot/blob/2.0.0-dev/scripts/recipe_robot_lib/facts.py#L116). This would explain why it's an issue in the app and not at the command line; these notifications are how the app receives status information from the command line tool. If the notifications aren't working, no output would be displayed.

My theory: the version of PyObjC included in AutoPkg 2.x's Python 3 framework requires changes for these notifying objects in order to make them communicate to the Recipe Robot app in Python 3.

Thanks in advance if you're able to reproduce this issue and provide any suggestions.

StuFyfe commented 3 years ago

I've reproduced issue, got exactly the same results as you. I did notice an extra "--" gets passed in arguments from the GUI, but that doesn't seem to be related to the problem. I've run out of useful skills though so can't offer anything constructive about why.

homebysix commented 3 years ago

Fixed by #163 — thanks @sheagcraig!