Skip to content

Commit

Permalink
Integrate yaml/pyyaml#602
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 13, 2024
1 parent 5db6c9a commit 9588004
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions ports/py-pyyaml/cython.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 3237b4074243704a9cce41dbf6dc14a2a2d4d78e Mon Sep 17 00:00:00 2001
From: Matt Davis <mrd@redhat.com>
Date: Wed, 12 Jan 2022 15:29:48 -0800
Subject: [PATCH] WIP keep PyYAML build working on Cython3.0.0a10+

* Cython 3.0 changes its build_ext command base class to one that's incompatible with pyyaml's subclass
* temporarily force use of Cython3's `old_build_ext` compatibility class if present
---
pyproject.toml | 2 +-
setup.py | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 2bf5ec80..3cf9a28d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,3 @@
[build-system]
-requires = ["setuptools", "wheel", "Cython"]
+requires = ["setuptools", "wheel", "Cython~=3.0a"]
build-backend = "setuptools.build_meta"
diff --git a/setup.py b/setup.py
index 548b19f7..da4a66fa 100644
--- a/setup.py
+++ b/setup.py
@@ -81,7 +81,11 @@
with_cython = True
try:
from Cython.Distutils.extension import Extension as _Extension
- from Cython.Distutils import build_ext as _build_ext
+
+ try:
+ from Cython.Distutils.old_build_ext import old_build_ext as _build_ext
+ except ImportError:
+ from Cython.Distutils import build_ext as _build_ext
with_cython = True
except ImportError:
if with_cython:
2 changes: 2 additions & 0 deletions ports/py-pyyaml/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ vcpkg_from_pythonhosted(
PACKAGE_NAME PyYAML
VERSION ${VERSION}
SHA512 94a29924484f557c0966d485c2b70232909253f27fcea9b89e1db1462abf61f2f85d55fbae0177b2bed70eb5daa75813551e868df4df4cddfdee9a87bd08485f
PATCHES
cython.patch
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
Expand Down

0 comments on commit 9588004

Please sign in to comment.