diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 2230ae9..1526b19 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -65,6 +65,17 @@ jobs: # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Build libmixin.a + if: ${{ matrix.os == 'windows-2019' }} + working-directory: src/mixin + shell: cmd + run: | + choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" + go build -o mixin.dll -buildmode=c-shared + copy mixin.dll ../../pysrc/mixin.dll + gendef mixin.dll + cmd /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat`" && lib /def:mixin.def /machine:x64 /out:mixin.lib" + - name: Build libmixin.a + if: ${{ matrix.os != 'windows-2019' }} working-directory: src/mixin run: | go build -o libmixin.a -buildmode=c-archive diff --git a/setup.py b/setup.py index 4d92cec..b2b70ee 100644 --- a/setup.py +++ b/setup.py @@ -28,31 +28,6 @@ dir_name = os.path.dirname(os.path.realpath(__file__)) -root_path = os.path.join(dir_name, 'src/mixin') -def check_modification(): - lib_name = os.path.join(root_path, 'libmixin.a') - if not os.path.exists(lib_name): - return True - modify_time = os.path.getmtime(lib_name) - for root, dirs, files in os.walk(root_path): - for f in files: - if f[-3:] == '.go': - f = os.path.join(root, f) - file_time = os.path.getmtime(f) - if modify_time < file_time: - return True - return False - -r = check_modification() -if r: - print('mixin lib need to rebuild.') - os.system(f'touch {root_path}/main.go') - -if platform.system() == 'Windows': - os.system('cd ./src/mixin &&go build -o mixin.dll -buildmode=c-shared && copy mixin.dll ../../pysrc/mixin.dll && gendef mixin.dll && lib /def:mixin.def /machine:x64 /out:mixin.lib') -else: - os.system('cd ./src/mixin;go build -o libmixin.a -buildmode=c-archive') - ext_modules = [ Extension( 'pymixin._mixin',