Skip to content

Commit 9a67379

Browse files
Copilotwannaphong
andcommitted
Fix CI failures: Add Windows support and remove Python 3.7
- Add platform-specific compiler flags in setup.py (MSVC for Windows, GCC/Clang for Unix) - Remove Python 3.7 from test matrix (EOL, not available on latest runners) - Update python_requires to >=3.8 - Fixes MSVC error: "invalid numeric argument '/Wextra'" Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
1 parent 8c01db9 commit 9a67379

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
fail-fast: false
6565
matrix:
6666
os: [ubuntu-latest, macos-latest, windows-latest]
67-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
67+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
6868

6969
steps:
7070
- name: Checkout code

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22

33
from setuptools import setup, Extension
44
import os
5+
import sys
56

67
# Read README for long description
78
with open("README.md", "r", encoding="utf-8") as fh:
89
long_description = fh.read()
910

11+
# Platform-specific compiler flags
12+
if sys.platform == "win32":
13+
# MSVC compiler flags
14+
extra_compile_args = ["/W3", "/O2"]
15+
else:
16+
# GCC/Clang compiler flags
17+
extra_compile_args = ["-Wall", "-Wextra", "-O2"]
18+
1019
# Define the C extension module
1120
cthainlp_extension = Extension(
1221
name="_cthainlp",
@@ -17,7 +26,7 @@
1726
"python/cthainlp_wrapper.c",
1827
],
1928
include_dirs=["include"],
20-
extra_compile_args=["-Wall", "-Wextra", "-O2"],
29+
extra_compile_args=extra_compile_args,
2130
)
2231

2332
setup(
@@ -36,14 +45,13 @@
3645
"Intended Audience :: Developers",
3746
"License :: OSI Approved :: Apache Software License",
3847
"Programming Language :: Python :: 3",
39-
"Programming Language :: Python :: 3.7",
4048
"Programming Language :: Python :: 3.8",
4149
"Programming Language :: Python :: 3.9",
4250
"Programming Language :: Python :: 3.10",
4351
"Programming Language :: Python :: 3.11",
4452
"Programming Language :: C",
4553
"Topic :: Text Processing :: Linguistic",
4654
],
47-
python_requires=">=3.7",
55+
python_requires=">=3.8",
4856
include_package_data=True,
4957
)

0 commit comments

Comments
 (0)