Creation a build matrix to support various python versions.

This commit is contained in:
Nathan Richard 2019-04-25 17:11:53 +02:00
parent a6e11d88e2
commit b11f642b81
3 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,15 @@
environment: environment:
APP_VERSION: '2.1' 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}' version: '$(APP_VERSION).{build}'
@ -13,7 +23,7 @@ build_script:
- cd miniupnpc - cd miniupnpc
- appveyor AddCompilationMessage "Building miniupnpc" - appveyor AddCompilationMessage "Building miniupnpc"
- mingw32-make -f Makefile.mingw - 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: after_build:
- 7z a ..\miniupnpc-%APPVEYOR_BUILD_VERSION%.zip *.exe *.dll *.a *.lib - 7z a ..\miniupnpc-%APPVEYOR_BUILD_VERSION%.zip *.exe *.dll *.a *.lib
@ -21,5 +31,5 @@ after_build:
artifacts: artifacts:
- path: miniupnpc-$(appveyor_build_version).zip - path: miniupnpc-$(appveyor_build_version).zip
name: miniupnpc binaries 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 name: miniupnpc python module

View File

@ -8,6 +8,7 @@
# make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar # make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar
# #
CC ?= gcc CC ?= gcc
SETUP_COMPILER_FLAG?=
DLLWRAP = dllwrap DLLWRAP = dllwrap
SH = /bin/sh SH = /bin/sh
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@ -46,7 +47,7 @@ libminiupnpc.a: $(OBJS)
$(AR) cr $@ $? $(AR) cr $@ $?
pythonmodule: libminiupnpc.a pythonmodule: libminiupnpc.a
$(PYTHON) setupmingw32.py build $(PYTHON) setupmingw32.py build $(SETUP_COMPILER_FLAG)
$(PYTHON) setupmingw32.py install --skip-build $(PYTHON) setupmingw32.py install --skip-build
miniupnpc.dll: libminiupnpc.a $(OBJSDLL) miniupnpc.dll: libminiupnpc.a $(OBJSDLL)

View File

@ -6,6 +6,13 @@
# #
# python script to build the miniupnpc module under windows (using mingw32) # 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: try:
from setuptools import setup, Extension from setuptools import setup, Extension
except ImportError: except ImportError:
@ -22,7 +29,7 @@ setup(name="miniupnpc",
description='miniUPnP client', description='miniUPnP client',
ext_modules=[ ext_modules=[
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
libraries=["ws2_32", "iphlpapi", "legacy_stdio_definitions"], libraries=["ws2_32", "iphlpapi"] + compat_lib,
extra_objects=["libminiupnpc.a"]) extra_objects=["libminiupnpc.a"])
]) ])