pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
939 stars 155 forks source link

Windows - Meson does not check if the version of installed libraries match with the one built with #3099

Closed bilhox closed 1 month ago

bilhox commented 2 months ago

Hello,

First of all, this is more an enhancement proposal. A fast solution is just to delete prebuild directories, and let meson (download_win_prebuilt.py) recreate them.

Currently this is how meson checks if libraries are downloaded and download them if it's not the case :

prebuilt_dir = base_dir / 'prebuilt-' + arch_suffix

    # download prebuilts (uses legacy builconfig code)
    if not fs.is_dir(prebuilt_dir)
        run_command(
            [
                find_program('python3', 'python'),
                'buildconfig/download_win_prebuilt.py',
            ],
            check: true,
        )
    endif

As you can see it only checks if the directory is here. So basically if the version does not match with the downloaded version, it should delete the directories, and redownload them.

Starbuck5 commented 2 months ago

I see the root problem as the buildconfig being too picky about dependency versions. If the new bundled is 2.30.7 and I only have 2.30.6 downloaded it should still build fine.

But I see why the meson buildconfig was written the way it was, it's not trying to change too much stuff from the setup.py buildconfig, so it doesn't change the directories so that the SDL version number isn't in the directory name.

ankith26 commented 2 months ago

This was kinda intentional really. As starbuck said, it just follows closely what the old buildconfig is doing. So I don't see anything that needs fixing here

bilhox commented 2 months ago

@ankith26 As I said, it's more an enhancement proposal (forgot to add the label btw). I know it's intentional, but could be interesting to make the install program smarter.

ankith26 commented 2 months ago

Hmm, thinking about it, I think the current behavior is actually better than what you propose because it gives the developer more control. With the current system, you just gotta delete the existing prebuilts folder to force an upgrade.

Now I'm not a windows user, but I can see the usecase for a dev downgrading SDL. If the buildconfig is going to "auto upgrade", it may lead to conflicts

bilhox commented 2 months ago

I think there might be a better solution, proposing a better error message if it fails to find the correct version.