Skip to content

Removed distutils from MinGW detection#4817

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:mingw
Jul 29, 2020
Merged

Removed distutils from MinGW detection#4817
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:mingw

Conversation

@radarhere
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants