Previous Thread
Next Thread
Print Thread
Joined: Feb 2004
Posts: 2,274
Likes: 14
Very Senior Member
OP Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,274
Likes: 14
MAME 0.237 will require Python 3 to build. The tipping point is that we’re getting localisability issues from not being able to use message contexts, because the obsolete version of msgfmt.py we’re using doesn’t support them. Upgrading msgfmt.py increases the requirement to Python 3.2. Most systems have been supplying Python 3 for years, either as a python3 command, or in place of Python 2.

The issue is, Apple still ships Python 2.7 and has said that a future version of macOS will not include Python at all, so developers are going to need to install Python 3 from somewhere. Python 3 can be installed using an official installation package (e.g. from here for Python 3.10), via MacPorts, or via Homebrew.

It’s been long enough, the workarounds for supporting both Python 2 and Python 3 are becoming impractical to maintain. It’s unfortunate that the number of steps to set up a build environment on macOS has to increase, but sticking with Python 2 is holding us back now.

The one exception will be minimaws, which will continue to support Python 2 until RHEL7 falls out of support, as it has to be able to run on the version of Python that Apache loads.

Joined: Mar 2001
Posts: 16,807
Likes: 32
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,807
Likes: 32
So before I quit in disgust, what exactly are we using Python for where we can't control the localization of the input data?

Joined: Feb 2004
Posts: 2,274
Likes: 14
Very Senior Member
OP Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,274
Likes: 14
I think you’re missing a bunch of stuff.

We’re using Python to run various scripts to generate source during the build process (e.g. OG’s CPU cores, compressing internal layouts into C arrays, and generating the stuff needed for SOURCES= builds). The requirement for Python isn’t going away – Python is the most widespread scripting language for these kinds of build tasks.

One of the things we use a Python script for is generating the compiled binary .mo files from the .po source for our UI translations. We use a Python script from the CPython i18n package because it’s easy to include with our source, and the alternative would be requiring people to install GNU gettext tools in order to build MAME, or writing our own msgfmt clone. Support for localisation of the internal UI isn’t going away – it’s very popular in China and Brazil in particular, and it’s one of the features that allowed us to out-compete MAME Plus! simply by providing what users want. It’s also one of the ways non-programmers can contribute to MAME.

The CPython msgfmt clone doesn’t support all the features of GNU msgfmt. The latest version doesn’t support the features needed for correct plural grammar, and the version we have checked in now also doesn’t support message context. You need message context to avoid what’s known as “the wind/wind problem” – identical messages in the source language needing to be translated differently depending on context (so named because of the English homographs for the weather phenomenon wind and the verb to wind, as in winding a watch). I’m finding issues where this is affecting us in our internal UI.

The alternatives are to get message context support are to update to the latest version of CPython’s msgfmt clone, which requires Python 3, require everyone to install GNU gettext, or write a msgfmt clone of our own. The second option adds an additional tool dependency, which is more distasteful than raising the required version of an existing dependency; the third option is way more work and potential for breakage than it’s worth. Requiring Python 3 also lets us get rid of some hacks and workarounds required to write code that will run under both Python 2 and Python 3, since Python 3 breaks compatibility.

The first version of Python 3 worth using was Python 3.2, which was released in February 2011, over a decade ago. Python 3 has been mature enough to use for a long time now. Python 2 completely fell out of support in January 2020, which is almost two years ago now. Most systems have shipped with Python 3 for over a decade now, and Python 2 is increasingly being dropped.

The main reason we’ve stuck with Python 2 support for so long is Apple. When Python 3 became stable, Apple announced that they would not be including Python 3 in any future version of macOS, and instead would remove Python altogether at some point in the future. We’re relying on an outdated version of a program which is considered a deprecated feature of the operating system. Something’s got to give at some point. Python 3 is readily available for macOS from the official Python site as well as from the open source package managers. It’s going to be no worse than SDL from a user point of view. It also won’t be required for regular users, only people who want to compile MAME themselves.

Joined: May 2009
Posts: 1,964
Likes: 23
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,964
Likes: 23
I'm going to summarize it in a more incisive way:

RB, I know you're a game developer, and you and I both know very well that what Apple is moving towards is hostile towards both open-source development and, to a large extent, game developers. You and I both know very well that build chains tend to rely on Python, too. So before you go off half-cocked threatening to quit MAME over a bad situation that Apple are ultimately responsible for the project being in, take a moment to talk to the build engineers you work with every day and see if they're planning on quitting, too.

You've chosen to hitch the wagon of "what do I use day-to-day at home" to a company that is increasingly hostile towards open-source projects, that isn't anything that should remotely be news at this point. Threatening to quit over it ultimately doesn't help anyone. It doesn't help MAME, and it's not going to ameliorate the fact that Apple are open-source-hostile. Choose your battles, dude.

1 member likes this: Darkstar
Joined: Dec 2011
Posts: 172
Senior Member
Offline
Senior Member
Joined: Dec 2011
Posts: 172
This sort of shit is why I keep saying that Mac users don't deserve software. Even fucking Microsoft is less dev-hostile than Apple.

Last edited by Alegend45; 10/08/21 09:43 PM.
Joined: Mar 2001
Posts: 16,807
Likes: 32
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,807
Likes: 32
Apple's not hostile to open source or to gamedev. I mean, they backed up the money truck so Dylan "Starfox" Cuthbert and his team at Q-Games could remake Frogger into a surprisingly good lite Mario 64 clone, and they convinced Konami to drop microtransactions from some of their games, which is kind of like getting Activision to stop making COD. They support several open source projects, and they opened the M1 boot loader for Marcan to get in and play.

My objections are unrelated to any of that, though:
- I'm going to incur the support burden for this change, and I don't like being ambushed with stuff like that.
- There is traditionally a time and a place for breaking everyone's toolchain when building MAME and it's the first build of a new year. This is not that.

Joined: Feb 2004
Posts: 2,274
Likes: 14
Very Senior Member
OP Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,274
Likes: 14
  • You don’t have to bear any support burden – you can tell people to fuck off and solve their own problems.
  • Downloading a PKG and double-clicking it is pretty fucking easy. They can also “brew install python3” if that’s more to their taste (although I think Homebrew installs Python 3 by default anyway). It will be documented in the compiling instructions, too.
  • I’ve held out on this for years while OG & Co. have been on my arse about dropping an obsolete tool, hoping Apple would see the light. It’s been long enough.
  • This has to fit in with my life as well. I’ve had a few days where I’ve been lucid enough to do some work on the internal UI. I’m not throwing that away or telling the Chinese MAME users that we don’t give a fuck about localisation support.

Joined: Feb 2004
Posts: 2,274
Likes: 14
Very Senior Member
OP Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,274
Likes: 14
This is another case where I can’t win – MAME’s UI is shit, inadequate tools are holding us back, and if I have to wait a whole year because I didn’t change the Python requirement last November along with the C++ requirement, I’m never going to be able to get anything done.

Joined: Feb 2004
Posts: 2,274
Likes: 14
Very Senior Member
OP Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,274
Likes: 14
Also, CMake isn’t going to happen right on January, so you’re going to have another tool update that’s not on a yearly cadence.

Joined: Mar 2008
Posts: 207
Likes: 2
R
Senior Member
Offline
Senior Member
R
Joined: Mar 2008
Posts: 207
Likes: 2
In my experience, just install python3 and put the installation path before any other path. It's as easy as that.

MacOS will get to its python 2.7 path without any problem.

I'm with RB in that Apple is not dev-hostile. In any case, it's the Python2-Python3 split the thing that ultimately caused problems.

And, if you're a developer or someone that it's used to compile programs, you'll probably have both installed anyway, so no big deal.


Link Copied to Clipboard
Who's Online Now
6 members (Bletch, R. Belmont, Reznor007, AJR, SoltanGris42, 1 invisible), 24 guests, and 7 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,974
Posts117,891
Members5,001
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com