diff --git a/appveyor.yml b/appveyor.yml index 528e649..f470b75 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,15 @@ environment: APP_VERSION: '2.1' + matrix: + - PYTHON_VER: C:\Python27\python + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + SETUP_COMPILER_FLAG: --compiler=mingw32 + - PYTHON_VER: C:\Python35\python + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + SETUP_COMPILER_FLAG: + - PYTHON_VER: C:\Python37\python + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + SETUP_COMPILER_FLAG: version: '$(APP_VERSION).{build}' @@ -13,7 +23,7 @@ build_script: - cd miniupnpc - appveyor AddCompilationMessage "Building miniupnpc" - mingw32-make -f Makefile.mingw - - mingw32-make -f Makefile.mingw pythonmodule PYTHON=C:\Python37\python + - mingw32-make -f Makefile.mingw pythonmodule PYTHON=%PYTHON_VER% after_build: - 7z a ..\miniupnpc-%APPVEYOR_BUILD_VERSION%.zip *.exe *.dll *.a *.lib @@ -21,5 +31,5 @@ after_build: artifacts: - path: miniupnpc-$(appveyor_build_version).zip name: miniupnpc binaries - - path: miniupnpc/dist/miniupnpc-$(APP_VERSION)-py3.7-win32.egg + - path: miniupnpc/dist/miniupnpc-$(APP_VERSION)-*-win32.egg name: miniupnpc python module diff --git a/miniupnpc/Makefile.mingw b/miniupnpc/Makefile.mingw index 739e792..0c18b53 100644 --- a/miniupnpc/Makefile.mingw +++ b/miniupnpc/Makefile.mingw @@ -8,6 +8,7 @@ # make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar # CC ?= gcc +SETUP_COMPILER_FLAG?= DLLWRAP = dllwrap SH = /bin/sh ifeq ($(OS),Windows_NT) @@ -46,7 +47,7 @@ libminiupnpc.a: $(OBJS) $(AR) cr $@ $? pythonmodule: libminiupnpc.a - $(PYTHON) setupmingw32.py build + $(PYTHON) setupmingw32.py build $(SETUP_COMPILER_FLAG) $(PYTHON) setupmingw32.py install --skip-build miniupnpc.dll: libminiupnpc.a $(OBJSDLL) diff --git a/miniupnpc/setupmingw32.py b/miniupnpc/setupmingw32.py index e1b40bb..3b3f6ff 100755 --- a/miniupnpc/setupmingw32.py +++ b/miniupnpc/setupmingw32.py @@ -6,6 +6,13 @@ # # python script to build the miniupnpc module under windows (using mingw32) # +import sys + +if (sys.version_info.major * 10 + sys.version_info.minor) >= 35: + compat_lib = ["legacy_stdio_definitions"] +else: + compat_lib = [] + try: from setuptools import setup, Extension except ImportError: @@ -22,7 +29,7 @@ setup(name="miniupnpc", description='miniUPnP client', ext_modules=[ Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], - libraries=["ws2_32", "iphlpapi", "legacy_stdio_definitions"], + libraries=["ws2_32", "iphlpapi"] + compat_lib, extra_objects=["libminiupnpc.a"]) ])