Skip to content

Commit

Permalink
CI: download libev via conan, for windows builds to have it
Browse files Browse the repository at this point in the history
windows builds so far was running with having libev available
and until this sync the fallback for python 3.12 was asyncio
eventloop, but now we fail and not fall back to asyncio.
so all unittest on windows are failing on any import from
cassandra.connection.

in this change we use conan to download libev, and using
it to compile the driver with libev

Ref: https://conan.io/center/recipes/libev
  • Loading branch information
fruch committed Jun 10, 2024
1 parent 90b17c6 commit 4de70bf
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CFLAGS='-g0 -O3'"
CIBW_SKIP: cp35* cp36* *musllinux*
CIBW_BUILD_VERBOSITY: 3

jobs:
build_wheels:
Expand Down Expand Up @@ -65,6 +66,18 @@ jobs:
run: |
choco install openssl --version=3.3.1 -f -y
- name: Install Conan
if: runner.os == 'Windows'
uses: turtlebrowser/get-conan@main

- name: configure libev for Windows
if: runner.os == 'Windows'
run: |
conan profile detect
conan install conanfile.py
$env_vars = Get-Content .\build-release\conan\conandeps.env -Raw
echo "CIBW_ENVIRONMENT_WINDOWS=$env_vars" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Install OpenSSL for MacOS
if: runner.os == 'MacOs'
run: |
Expand Down
56 changes: 56 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from pathlib import Path

from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.internal import check_duplicated_generator
from conan.tools.files import save


CONAN_COMMANDLINE_FILENAME = "conandeps.env"

class CommandlineDeps:
def __init__(self, conanfile):
"""
:param conanfile: ``< ConanFile object >`` The current recipe object. Always use ``self``.
"""
self._conanfile = conanfile

def generate(self) -> None:
"""
Collects all dependencies and components, then, generating a Makefile
"""
check_duplicated_generator(self, self._conanfile)

host_req = self._conanfile.dependencies.host
build_req = self._conanfile.dependencies.build # tool_requires
test_req = self._conanfile.dependencies.test

content_buffer = ""

# Filter the build_requires not activated for any requirement
dependencies = [tup for tup in list(host_req.items()) + list(build_req.items()) + list(test_req.items()) if not tup[0].build]

for require, dep in dependencies:
# Require is not used at the moment, but its information could be used, and will be used in Conan 2.0
if require.build:
continue
include_dir = Path(dep.package_folder) / 'include'
package_dir = Path(dep.package_folder) / 'lib'
content_buffer += f"CFLAGS='-I{include_dir}' LDFLAGS='-L{package_dir}'"

save(self._conanfile, CONAN_COMMANDLINE_FILENAME, content_buffer)
self._conanfile.output.info(f"Generated {CONAN_COMMANDLINE_FILENAME}")


class python_driverConan(ConanFile):
win_bash = False

settings = "os", "compiler", "build_type", "arch"
requires = "libev/4.33"

def layout(self):
basic_layout(self)

def generate(self):
pc = CommandlineDeps(self)
pc.generate()

0 comments on commit 4de70bf

Please sign in to comment.