Skip to content

Commit d23183d

Browse files
committed
1
1 parent 281db08 commit d23183d

File tree

3 files changed

+35
-51
lines changed

3 files changed

+35
-51
lines changed

.github/workflows/lib-build-and-push.yml

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ on:
2121
required: false
2222
default: "linux,macos,windows"
2323

24-
env:
25-
CIBW_ARCHS_WINDOWS: "AMD64"
26-
2724
jobs:
2825
prepare-matrix:
2926
name: "Prepare matrix to run for ${{ inputs.python-version }} on `${{ inputs.target }}`"
@@ -86,7 +83,8 @@ jobs:
8683
- name: Install OpenSSL for Windows
8784
if: runner.os == 'Windows'
8885
run: |
89-
choco install openssl --version=3.4.1 -f -y
86+
choco install openssl --version=3.4.1 -f -y --no-progress
87+
choco install llvm -y --no-progress
9088
9189
- name: Install Conan
9290
if: runner.os == 'Windows'
@@ -115,45 +113,34 @@ jobs:
115113
echo "Enforcing target deployment for 14.0"
116114
fi
117115
118-
# - name: Add clang path to $PATH env
119-
# if: runner.os == 'Windows'
120-
# run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
121-
122-
- name: Add clang path to $PATH env
123-
if: runner.os == 'Windows'
124-
run: |
125-
echo "CC=clang" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
126-
echo "CXX=clang++" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
127-
128-
- name: Check Clang Version
129-
run: clang --version
130-
131-
- name: Force Clang for Compilation
132-
run: |
133-
echo "[build]" >> $HOME/.pydistutils.cfg
134-
echo "compiler=clang" >> $HOME/.pydistutils.cfg
116+
- name: Show clang-cl version
117+
run: clang-cl --version
135118

136-
- name: Ensure cl.exe is Removed
119+
- name: Add clang to PATH
120+
shell: pwsh
137121
run: |
138-
cl.exe --version
122+
echo "C:\Program Files\LLVM\bin" >> $Env:GITHUB_PATH
139123
140-
- name: Build wheels for windows
141-
if: runner.os == 'Windows'
124+
- name: Build wheels
125+
if: runner.os != 'Windows'
142126
run: |
143-
$envPath = $env:Path
144-
echo $envPath
145-
$pathArray = $envPath -split ";"
146-
$filteredPaths = $pathArray | Where-Object { $_ -notmatch "Microsoft Visual Studio" }
147-
$newPath = ($filteredPaths -join ";").TrimEnd(";")
148-
echo $newPath
149-
$env:Path = $newPath
150-
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "User")
151127
python3 -m cibuildwheel --output-dir wheelhouse
152128
153129
- name: Build wheels
154-
if: runner.os != 'Windows'
130+
if: runner.os == 'Windows'
155131
run: |
156-
python3 -m cibuildwheel --output-dir wheelhouse
132+
python3 -m cibuildwheel --output-dir wheelhouse --platform windows
133+
env:
134+
CIBW_ENVIRONMENT_WINDOWS: 'CC=clang-cl CXX=clang-cl DISTUTILS_USE_SDK=1 LDSHARED="clang -shared" ARFLAGS=rcs AR=llvm-ar CFLAGS="/nologo /O2 /W3 /DNDEBUG /D_CRT_SECURE_NO_WARNINGS /MD" CXXFLAGS="/nologo /O2 /W3 /DNDEBUG /D_CRT_SECURE_NO_WARNINGS /EHsc /MD /std:c++17" '
135+
CC: clang-cl
136+
CXX: clang-cl
137+
DISTUTILS_USE_SDK: 1
138+
CIBW_BUILD_VERBOSITY: 3
139+
LDSHARED: clang -shared
140+
ARFLAGS: rcs
141+
AR: llvm-ar
142+
CFLAGS: /nologo /O2 /W3 /DNDEBUG /D_CRT_SECURE_NO_WARNINGS /MD
143+
CXXFLAGS: /nologo /O2 /W3 /DNDEBUG /D_CRT_SECURE_NO_WARNINGS /EHsc /MD /std:c++17
157144

158145
- uses: actions/upload-artifact@v4
159146
with:
@@ -227,9 +214,6 @@ jobs:
227214
permissions:
228215
id-token: write
229216

230-
# upload to PyPI on every tag starting with 'v'
231-
# alternatively, to publish when a GitHub Release is created, use the following rule:
232-
# if: github.event_name == 'release' && github.event.action == 'published'
233217
steps:
234218
- uses: actions/download-artifact@v4
235219
with:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ test-command = [
122122
"pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\""
123123
]
124124

125-
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "yes", CC = "clang", CXX = "clang++" }
125+
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "yes", CC = "clang-cl", CXX = "clang-cl" }
126126

127127
[[tool.cibuildwheel.overrides]]
128128
select = "pp*"

setup.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@
1414

1515
from __future__ import print_function
1616

17-
import fnmatch
1817
import os
1918
import shutil
2019
import sys
2120
import json
2221
import warnings
2322
from pathlib import Path
24-
from sysconfig import get_config_vars
2523

26-
if __name__ == '__main__' and sys.argv[1] == "gevent_nosetests":
27-
print("Running gevent tests")
28-
from gevent.monkey import patch_all
29-
patch_all()
30-
31-
if __name__ == '__main__' and sys.argv[1] == "eventlet_nosetests":
32-
print("Running eventlet tests")
33-
from eventlet import monkey_patch
34-
monkey_patch()
24+
if __name__ == '__main__' and len(sys.argv) > 1:
25+
if sys.argv[1] == "gevent_nosetests":
26+
print("Running gevent tests")
27+
from gevent.monkey import patch_all
28+
patch_all()
29+
elif sys.argv[1] == "eventlet_nosetests":
30+
print("Running eventlet tests")
31+
from eventlet import monkey_patch
32+
monkey_patch()
3533

3634
from setuptools.command.build_ext import build_ext
3735
from setuptools import Extension, Command, setup
@@ -57,7 +55,7 @@ class eventlet_nosetests(nosetests):
5755
description = "run nosetests with eventlet monkey patching"
5856

5957
has_cqlengine = False
60-
if __name__ == '__main__' and sys.argv[1] == "install":
58+
if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] == "install":
6159
try:
6260
import cqlengine
6361
has_cqlengine = True
@@ -300,6 +298,8 @@ class build_extensions(build_ext):
300298
"""
301299

302300
def run(self):
301+
if sys.platform.startswith('win'):
302+
self.compiler = 'unix'
303303
try:
304304
self._setup_extensions()
305305
build_ext.run(self)

0 commit comments

Comments
 (0)