Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
MinGW: Passing -DMS_WIN32 or -DMS_WIN64 is a must
Browse files Browse the repository at this point in the history
Do not rely on a patched distutils, pass these flags explicitly.

xref: https://stackoverflow.com/a/19867426
  • Loading branch information
nehaljwani authored and peterjc committed Dec 28, 2017
1 parent c022e75 commit fc6e20b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions setup.py
Expand Up @@ -29,14 +29,25 @@

lzmalib = '%slzma'%('lib' if sys.platform == 'win32' else '')

is32bit = tuple.__itemsize__ == 4


class build_ext_subclass(build_ext):
def build_extensions(self):
c = self.compiler.compiler_type
if c == "mingw32" and sys.maxsize <= 2**32:
for e in self.extensions:
e.extra_compile_args = ["-mstackrealign"]
xtra_compile_args = []

if self.compiler.compiler_type == "mingw32":
xtra_compile_args = [
"-DMS_WIN32",
"-mstackrealign"
] if is32bit else ["-DMS_WIN64"]

for e in self.extensions:
e.extra_compile_args = xtra_compile_args

build_ext.build_extensions(self)


packages = ["backports", "backports.lzma"]
prefix = sys.prefix
home = os.path.expanduser("~")
Expand Down

0 comments on commit fc6e20b

Please sign in to comment.