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

Removed distutils from MinGW detection #4817

Merged
merged 1 commit into from Jul 29, 2020
Merged

Conversation

radarhere
Copy link
Member

Helps #4796

In setup.py, there is

PLATFORM_MINGW = "mingw" in ccompiler.get_default_compiler()

Looking at ccompiler.get_default_compiler() on MinGW -

def get_default_compiler(osname=None, platform=None):
    ...
    if get_platform().startswith('mingw'):
        return 'mingw32'
def get_platform():
    if os.name == 'nt':
        TARGET_TO_PLAT = {
            'x86' : 'win32',
            'x64' : 'win-amd64',
            'arm' : 'win-arm32',
        }
        return TARGET_TO_PLAT.get(os.environ.get('VSCMD_ARG_TGT_ARCH')) or get_host_platform()
    else:
        return get_host_platform()
def get_host_platform():
    ...
    if os.name == 'nt':
        if 'GCC' in sys.version:
            return 'mingw'

Note that I find the code on MinGW slightly different to the one on my machine - mine does not include the MinGW lines.

So then the setup.py line can be replaced with

PLATFORM_MINGW = os.name == "nt" and "GCC" in sys.version

@hugovk hugovk merged commit 0d4e3eb into python-pillow:master Jul 29, 2020
@hugovk
Copy link
Member

hugovk commented Jul 29, 2020

Thanks!

@hugovk hugovk mentioned this pull request Jul 29, 2020
@radarhere radarhere deleted the mingw branch July 29, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants