Skip to content

Notarization fails for pygame-ce 2.5.4, but succeeds for 2.5.3Β #3468

Closed

Description

@davidfokkema

Environment:

Platform:		macOS-15.5-arm64-arm-64bit
System:			Darwin
System Version:		Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:25 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6020
Processor:		arm	SSE2: No	AVX2: No	NEON: Yes
Architecture:		Bits: 64bit	Linkage:

Python:			CPython 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:35:25) [Clang 16.0.6 ]
GIL Enabled:		True
pygame version:		2.5.4
SDL versions:		Linked: 2.32.6	Compiled: 2.32.6
SDL Mixer versions:	Linked: 2.8.1	Compiled: 2.8.1
SDL Font versions:	Linked: 2.24.0	Compiled: 2.24.0
SDL Image versions:	Linked: 2.8.8	Compiled: 2.8.8
Freetype versions:	Linked: 2.13.3	Compiled: 2.13.3

Display Driver:		Display Not Initialized
Mixer Driver:		Mixer Not Initialized

Current behavior:

I use Beeware's Briefcase to build an .app bundle, sign it, and submit it for notarization. I used the default minimal pygame template, so there is hardly any code. It just imports pygame and includes it in the binary. The notarization step fails and Apple's system gives the following unhelpful error message:

The signature of the binary is invalid.

The problem does not occur if I replace version 2.5.4 with 2.5.3.

Expected behavior:

The notarization step completes successfully when using pygame-ce 2.5.3.

Steps to reproduce:

Please explain the steps required to duplicate the issue, especially if you are able to provide a sample application.
if the bug is caused by a specific file (image, font, sound, level, please upload it as an attachment

  1. Install briefcase, make sure you have a code signing identity from Apple.
  2. briefcase new, choose a pygame template
  3. Replace pygame with pygame-ce==2.5.4 or pygame-ce==2.5.3 in pyproject.toml
  4. briefcase create
  5. briefcase build
  6. briefcase package
  7. Failure for 2.5.4, success for 2.5.3.

Activity

  1. davidfokkema commented on Jun 3, 2025

    @davidfokkema
    Author

    This is currently relevant for frescobaldi/frescobaldi#1987.

  2. oddbookworm commented on Jun 3, 2025

    @oddbookworm
    Member

    Suspect this is due to a dependency update funniness. Apple is weird about it and if your encodings aren't on point everywhere, it throws a fit

  3. oddbookworm commented on Jun 3, 2025

    @oddbookworm
    Member

    I'll try to investigate it soon

  4. davidfokkema commented on Jun 3, 2025

    @davidfokkema
    Author

    Thanks!

  5. freakboy3742 commented on Jun 3, 2025

    @freakboy3742

    These are definitely the hardest issues to debug - mostly because the feedback is minimal.

    The comment about encodings is definitely worth exploring. The last time I saw this problem, the fix ended up being that we needed to use ditto rather than zip to build the archive sent for notarization. If you're using Briefcase 0.3.23, you'll have that fix in place; but if PyGame-ce is doing anything... esoteric... with the filesystem, you could be hitting similar problems.

    There are a couple of ways to get slightly more information out of the notarization process. The briefcase log will show you the full return value from the commands that it issued, which may include a full JSON manifest of what has been packaged. If that doesn't help, if you run briefcase package with -vv you'll get the full command line invocation of what is being run; if you poke around those commands (in particular xcrun notary tool log and xcrun notarytool history), there's a couple of ways to get more debugging information from the notarization process. However, it's not likely to be much more than "this specific file was a problem".

  6. oddbookworm commented on Jun 4, 2025

    @oddbookworm
    Member

    @davidfokkema can you send the output of python -c "import pygame; pygame.init(); pygame.print_debug_info()"?
    It seems to be working fine for me on an M4 macbook air

  7. oddbookworm commented on Jun 4, 2025

    @oddbookworm
    Member

    Oh, maybe I didn't do the certificate right
    Something to look into tomorrow. It's already late...

  8. Starbuck5 commented on Jun 6, 2025

    @Starbuck5
    Member

    @freakboy3742 on the issue tracker 🀩

    Is it possible this is the briefcase bundle not being updated for the new version? Like these are fresh builds right, it's not starting with 2.5.3 and then going to 2.5.4 with the same bundle?

    @davidfokkema If this persists on totally fresh builds (which I think you've checked but would be nice if that was the issue), here are some GH actions runs you could try that contain wheels from between 2.5.3 and 2.5.4, to help us narrow down where this came from:

    2/28 https://github.com/pygame-community/pygame-ce/actions/runs/13597292718 expired artifact
    3/17 https://github.com/pygame-community/pygame-ce/actions/runs/13895057664
    4/6 https://github.com/pygame-community/pygame-ce/actions/runs/14297840133
    4/23 https://github.com/pygame-community/pygame-ce/actions/runs/14634784622
    5/14 https://github.com/pygame-community/pygame-ce/actions/runs/15038303902

    Instructions:
    Download the arm wheel bundle
    Install the correct wheel into your environment manually pip install pygame_ce-2.5.4.dev1-cp310-cp310-macosx_11_0_arm64.whl

  9. freakboy3742 commented on Jun 6, 2025

    @freakboy3742

    @freakboy3742 on the issue tracker 🀩

    Is it possible this is the briefcase bundle not being updated for the new version? Like these are fresh builds right, it's not starting with 2.5.3 and then going to 2.5.4 with the same bundle?

    I don't know, but I can't rule it out as a source of the problem.

    I haven't done a lot of testing of "in place" upgrades like that; the assumption is usually that any release artefact will be built clean. It's entirely possible that there's something left over or stale from a previous build, or (more likely) that a new build hasn't picked up all the updated versions and requirements, and as a result the notarised artefact is internally inconsistent (and thus fails notarization).

  10. fedelibre commented on Jun 6, 2025

    @fedelibre

    Is it possible this is the briefcase bundle not being updated for the new version? Like these are fresh builds right, it's not starting with 2.5.3 and then going to 2.5.4 with the same bundle?

    I think we can rule it out as a source of the problem, as this issue was opened after this Github Action failed. And I'm fairly sure it's a fresh build.

  11. davidfokkema commented on Jun 6, 2025

    @davidfokkema
    Author

    I agree with @fedelibre and tested clean builds on my machine. The previous version only came into play when it was found that 2.5.4 gave a notarization error. I've intervened in the build process and I'm now trying out the various builds.

  12. davidfokkema commented on Jun 6, 2025

    @davidfokkema
    Author
  13. ankith26 commented on Jun 6, 2025

    @ankith26
    Member

    Thanks for narrowing down the range. Here are all the inbetween (your SUCCEEDS and the first FAILS) PRs ordered from least recent to most recent:

    PR 1: SUCCEEDS
    PR 2: #3380 (I kinda suspect this PR the most, but the thing is the CI didn't even run on it weirdly enough. This PR basically adds a whole bunch of tutorial files. Some of the tutorial files are in korean and we have already been bitten by encoding related issues here in the past)
    PR 3: https://github.com/pygame-community/pygame-ce/actions/runs/14020552610
    PR 4: https://github.com/pygame-community/pygame-ce/actions/runs/14024508125
    PR 5: https://github.com/pygame-community/pygame-ce/actions/runs/14030818740
    PR 6: #3374 (again CI didn't run on this PR, all it does is changes format of a few images. This could potentially also be problematic but IDK)
    PR 7: https://github.com/pygame-community/pygame-ce/actions/runs/14188734802
    PR 8: FAILS

    You way want to bisect this list too. If you find out that one of 3380 or 3374 is the issue we can make a PR reverting that change and you can test that PR out.

  14. added this to the 2.5.5 milestone on Jun 6, 2025
  15. 2 remaining items

  16. oddbookworm commented on Jun 6, 2025

    @oddbookworm
    Member

    I seriously doubt that it's PR3, that's just code formatting using ruff

  17. davidfokkema commented on Jun 6, 2025

    @davidfokkema
    Author

    I seriously doubt that it's PR3, that's just code formatting using ruff

    Sure, @ankith26 already suspected PR2 the most. But if there's no build I can test...

  18. ankith26 commented on Jun 6, 2025

    @ankith26
    Member

    I have made a PR reverting that PR. You can test that PR to see if that fixes the issue. The CI is still running but once its done, the wheels should be available at: https://github.com/pygame-community/pygame-ce/actions/runs/15488337078

  19. davidfokkema commented on Jun 6, 2025

    @davidfokkema
    Author

    Thanks, @ankith26, that build succeeds! I have only been testing the ARM wheels, but it certainly looks like the tutorials are the culprit!

  20. ankith26 commented on Jun 6, 2025

    @ankith26
    Member

    @davidfokkema I would appreciate if you can retest an updated version of my PR. I updated it to exclude only korean tutorials but added back the english and spanish ones https://github.com/pygame-community/pygame-ce/actions/runs/15489301095
    Merging that PR as is would also cause a regression on another issue so I am trying to strike a middle ground here.

  21. davidfokkema commented on Jun 6, 2025

    @davidfokkema
    Author

    That latest run also works. I've been reading up a bit and it does seem that filenames with non-ascii characters can mess up the notarization process. And there doesn't really seem to be a way around it until Apple starts supporting this, as it has on its own filesystems.

  22. freakboy3742 commented on Jun 7, 2025

    @freakboy3742

    FWIW: Filesystem encodings sounds entirely plausible as a cause of notarization failure - Notarization involves zipping the app bundle, and if that zip process doesn't round trip 100% identical (including all filesystem properties), then notarization will fail. I'm not sure if Apple has any firm guidance on "no non-ascii filenames in apps", but if that's a problem (and, ideally, if you're able to generate an easy reproduction case), it would be worth catching (or at least warning) at the Briefcase level.

  23. Starbuck5 commented on Jun 7, 2025

    @Starbuck5
    Member

    Fix for this is included in pygame-ce 2.5.5, which has just been released.

  24. davidfokkema commented on Jun 7, 2025

    @davidfokkema
    Author

    @freakboy3742 That sounds like a great idea. In that case it would be possible to strip them out through Briefcase config.

  25. oddbookworm commented on Jun 7, 2025

    @oddbookworm
    Member

    @davidfokkema Just as a sanity check, can you verify for us one more time that our actual 2.5.5 release build works properly for you?

  26. freakboy3742 commented on Jun 8, 2025

    @freakboy3742

    @freakboy3742 That sounds like a great idea. In that case it would be possible to strip them out through Briefcase config.

    @davidfokkema Could I request that you open this as a bug report on Briefcase? I haven't completely followed what file/filename was the cause of this problem (other than "non-ASCII"... possibly Korean Hangul is the problem?).

  27. davidfokkema commented on Jun 9, 2025

    @davidfokkema
    Author

    @davidfokkema Just as a sanity check, can you verify for us one more time that our actual 2.5.5 release build works properly for you?

    I’m traveling right now, and the bug surfaced in Frescobaldi. @fedelibre, could you check that Frescobaldi builds successfully with the latest version (2.5.5) of pygame-ce?

  28. davidfokkema commented on Jun 9, 2025

    @davidfokkema
    Author

    @davidfokkema Could I request that you open this as a bug report on Briefcase?

    I will, when I’m back in a few days!

  29. fedelibre commented on Jun 9, 2025

    @fedelibre

    I’m traveling right now, and the bug surfaced in Frescobaldi. @fedelibre, could you check that Frescobaldi builds successfully with the latest version (2.5.5) of pygame-ce?

    I've just built a new release with version 2.5.5 and I confirm that the builds are all Ok now.
    Thanks!

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

    bugNot working as intended

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions