commit:     54024ed6594d81a08715a50cd67bf0377350f67e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 15 13:54:08 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Apr 15 14:30:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54024ed6

dev-python/pygccxml: Bump to 2.5.0

Closes: https://bugs.gentoo.org/929489
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pygccxml/Manifest                       |  1 +
 .../pygccxml/files/pygccxml-2.5.0-which.patch      | 68 ++++++++++++++++++++++
 dev-python/pygccxml/pygccxml-2.5.0.ebuild          | 49 ++++++++++++++++
 3 files changed, 118 insertions(+)

diff --git a/dev-python/pygccxml/Manifest b/dev-python/pygccxml/Manifest
index 01e9b3c3f3e8..2b29408d2234 100644
--- a/dev-python/pygccxml/Manifest
+++ b/dev-python/pygccxml/Manifest
@@ -1 +1,2 @@
 DIST pygccxml-2.4.0.gh.tar.gz 3165189 BLAKE2B 
855b0b6313be29e7719abe4cc6e654904657c11bfd7310d647227ce9d7760821eeb348dcd9892afbcc3d467db96daaf3010e92803fe28962db9a255cf81eae46
 SHA512 
48bf4887344c68d0a93a3908cc0a744f3d6a74dce92be88527e85cf7ba1a46f88560730dce0b858f31523cada836aad40461de935c5c2a041de0fa2ae5e38c30
+DIST pygccxml-2.5.0.gh.tar.gz 3163862 BLAKE2B 
2a61474acab7e7a21b21bc7131a9b9aae2a318d3b761c9a3865055146331891e5fb2041a9136bd8816e60a4dc76a39a22d5f5632f22336341667eee537521a42
 SHA512 
499be7383ac9817c5620f7f0b2e6fdb9a6f5d934cc54a2ef9864877a2a7d896997ab5bc2e8b0c3c87df1ac7e4a384d3c8cbcc87f9496125502c97766df57b003

diff --git a/dev-python/pygccxml/files/pygccxml-2.5.0-which.patch 
b/dev-python/pygccxml/files/pygccxml-2.5.0-which.patch
new file mode 100644
index 000000000000..52ac56ed48f0
--- /dev/null
+++ b/dev-python/pygccxml/files/pygccxml-2.5.0-which.patch
@@ -0,0 +1,68 @@
+From 08f53536a0e76bab000df2837af4a13f06bbd4a7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Mon, 15 Apr 2024 15:50:39 +0200
+Subject: [PATCH] Use `shutil.which()` to get compiler path
+
+Remove the `__get_first_compiler_in_path()` function that used
+`which(1)` / `where` program to get the compiler path, with built-in
+`shutil.which()`.  This fixes pygccxml on systems where `which(1)`
+is no longer present (it is not a standard POSIX tool, and Linux
+distributions are working towards making it optional).
+---
+ src/pygccxml/parser/config.py | 28 +++++++---------------------
+ 1 file changed, 7 insertions(+), 21 deletions(-)
+
+diff --git a/src/pygccxml/parser/config.py b/src/pygccxml/parser/config.py
+index 1032b54e..4fe4a6a0 100644
+--- a/src/pygccxml/parser/config.py
++++ b/src/pygccxml/parser/config.py
+@@ -11,6 +11,7 @@
+ import os
+ import copy
+ import platform
++import shutil
+ import subprocess
+ import warnings
+ # In py3, ConfigParser was renamed to the more-standard configparser.
+@@ -451,35 +452,20 @@ def create_compiler_path(xml_generator, compiler_path):
+     if xml_generator == 'castxml' and compiler_path is None:
+         if platform.system() == 'Windows':
+             # Look for msvc
+-            compiler_path = __get_first_compiler_in_path('where', 'cl')
++            compiler_path = shutil.which('cl')
+             # No msvc found; look for mingw
+-            if compiler_path == '':
+-                compiler_path = __get_first_compiler_in_path('where', 'mingw')
++            if compiler_path is None:
++                compiler_path = shutil.which('mingw')
+         else:
+             # OS X or Linux
+             # Look for clang first, then gcc
+-            compiler_path = __get_first_compiler_in_path('which', 'clang++')
++            compiler_path = shutil.which('clang++')
+             # No clang found; use gcc
+-            if compiler_path == '':
+-                compiler_path = __get_first_compiler_in_path('which', 'c++')
+-
+-        if compiler_path == "":
+-            compiler_path = None
++            if compiler_path is None:
++                compiler_path = shutil.which('c++')
+ 
+     return compiler_path
+ 
+ 
+-def __get_first_compiler_in_path(command, compiler_name):
+-    p = subprocess.Popen(
+-        [command, compiler_name],
+-        stdout=subprocess.PIPE,
+-        stderr=subprocess.PIPE)
+-    path = p.stdout.read().decode("utf-8").rstrip().split("\r\n")[0].rstrip()
+-    p.wait()
+-    p.stdout.close()
+-    p.stderr.close()
+-    return path
+-
+-
+ if __name__ == '__main__':
+     print(load_xml_generator_configuration('xml_generator.cfg').__dict__)

diff --git a/dev-python/pygccxml/pygccxml-2.5.0.ebuild 
b/dev-python/pygccxml/pygccxml-2.5.0.ebuild
new file mode 100644
index 000000000000..3a2e39187e16
--- /dev/null
+++ b/dev-python/pygccxml/pygccxml-2.5.0.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="A specialized XML reader to navigate C++ declarations"
+HOMEPAGE="
+       https://github.com/CastXML/pygccxml/
+       https://pypi.org/project/pygccxml/
+"
+SRC_URI="
+       https://github.com/CastXML/pygccxml/archive/v${PV}.tar.gz
+               -> ${P}.gh.tar.gz
+"
+
+LICENSE="Boost-1.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~riscv ~x86"
+
+DEPEND="
+       ${PYTHON_DEPS}
+       dev-libs/castxml
+"
+RDEPEND="
+       ${DEPEND}
+"
+
+distutils_enable_tests pytest
+distutils_enable_sphinx docs dev-python/sphinx-rtd-theme
+
+EPYTEST_DESELECT=(
+       # TODO; too new LLVM?  upstream tests against LLVM 13
+       unittests/test_overrides.py::Test::test
+)
+
+python_prepare_all() {
+       local PATCHES=(
+               "${FILESDIR}/${PN}-2.4.0-doc.patch"
+               # https://github.com/CastXML/pygccxml/pull/179
+               "${FILESDIR}/${P}-which.patch"
+       )
+
+       distutils-r1_python_prepare_all
+}

Reply via email to