From caff77821cad1031430d7138794c7fa51dd567458512d6722e3e360780fd849f Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 22 Oct 2025 17:56:19 +0000 Subject: [PATCH 1/3] - Add graphviz_14-0-0.patch making the code compatible with gvRenderData signature from graphviz 14.0.* (bsc#1252488). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pygraphviz?expand=0&rev=36 --- .gitattributes | 23 +++++ .gitignore | 1 + README.txt | 6 ++ _multibuild | 3 + graphviz_14-0-0.patch | 40 +++++++++ pygraphviz-1.14.tar.gz | 3 + python-pygraphviz.changes | 172 ++++++++++++++++++++++++++++++++++++++ python-pygraphviz.spec | 129 ++++++++++++++++++++++++++++ 8 files changed, 377 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.txt create mode 100644 _multibuild create mode 100644 graphviz_14-0-0.patch create mode 100644 pygraphviz-1.14.tar.gz create mode 100644 python-pygraphviz.changes create mode 100644 python-pygraphviz.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8b63d6a --- /dev/null +++ b/README.txt @@ -0,0 +1,6 @@ +.. _examples_gallery: + +Gallery +======= + +Graph visualization examples with pygraphviz. diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..58ef5ee --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + doc + diff --git a/graphviz_14-0-0.patch b/graphviz_14-0-0.patch new file mode 100644 index 0000000..062d722 --- /dev/null +++ b/graphviz_14-0-0.patch @@ -0,0 +1,40 @@ +--- + pygraphviz/graphviz.i | 4 ++-- + setup.py | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +Index: pygraphviz-1.14/pygraphviz/graphviz.i +=================================================================== +--- pygraphviz-1.14.orig/pygraphviz/graphviz.i 2024-09-29 20:31:00.000000000 +0200 ++++ pygraphviz-1.14/pygraphviz/graphviz.i 2025-10-22 19:43:41.606164205 +0200 +@@ -338,7 +338,7 @@ + /* three lines are straight from the SWIG manual. */ + %include + %include +-%cstring_output_allocate_size(char **result, unsigned int* size, free(*$1)); +-int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, unsigned int *size); ++%cstring_output_allocate_size(char **result, size_t* size, free(*$1)); ++int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, size_t *size); + /* Free memory allocated and pointed to by *result in gvRenderData */ + extern void gvFreeRenderData (char* data); +Index: pygraphviz-1.14/setup.py +=================================================================== +--- pygraphviz-1.14.orig/setup.py 2024-09-29 20:31:00.000000000 +0200 ++++ pygraphviz-1.14/setup.py 2025-10-22 19:46:41.138483128 +0200 +@@ -2,14 +2,14 @@ + from setuptools import setup, Extension + + if __name__ == "__main__": +- define_macros = [("SWIG_PYTHON_STRICT_BYTE_CHAR", None)] ++ define_macros = [] + if sys.platform == "win32": + define_macros.append(("GVDLL", None)) + + extension = [ + Extension( + name="pygraphviz._graphviz", +- sources=["pygraphviz/graphviz_wrap.c"], ++ sources=["pygraphviz/graphviz.i"], + include_dirs=[], + library_dirs=[], + # cdt does not link to cgraph, whereas cgraph links to cdt. diff --git a/pygraphviz-1.14.tar.gz b/pygraphviz-1.14.tar.gz new file mode 100644 index 0000000..ad01733 --- /dev/null +++ b/pygraphviz-1.14.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c10df02377f4e39b00ae17c862f4ee7e5767317f1c6b2dfd04cea6acc7fc2bea +size 106003 diff --git a/python-pygraphviz.changes b/python-pygraphviz.changes new file mode 100644 index 0000000..a3480e4 --- /dev/null +++ b/python-pygraphviz.changes @@ -0,0 +1,172 @@ +------------------------------------------------------------------- +Wed Oct 22 17:55:37 UTC 2025 - Matej Cepl + +- Add graphviz_14-0-0.patch making the code compatible with + gvRenderData signature from graphviz 14.0.* (bsc#1252488). + +------------------------------------------------------------------- +Thu Feb 27 12:23:39 UTC 2025 - ecsos + +- Make it compatible wirh %{?sle15_python_module_pythons}. + +------------------------------------------------------------------- +Tue Oct 1 12:37:59 UTC 2024 - Dirk Müller + +- update 1.14: + * Avoid subprocess window creation with agraph.AGraph._run_prog + (#514). + * Support Python 3.13 (#542). + * AGraph.draw(): close filehandle for pathlib.Path (#535). + * Fix formatting (#538). + * Test on Python 3.13 (#539). + * Use ruff and update pre-commit config (#540). + +------------------------------------------------------------------- +Thu May 23 02:32:41 UTC 2024 - Steve Kowalik + +- Update to 1.13: + * Remove outdated pystrings.swg (#508). + * Fix segfault from repr attempting to access attrs on uninitialized + instance (#520). + * Add Python 3.12 support (#486). + * Copy edges keys when copying a graph + * Drop Python 3.8 support per SPEC 0 (#465). + * Drop Python 3.9 support (#487). + * Update documentation building requirements (#488). + * Add pyproject.toml (#471). + * Stop building pdf of the docs (#503). +- Drop patch docdir.patch, no longer needed. +- Build the documentation by hand, since now we need to, and do so in + its own flavor. +- Switch to pyproject macros. + +------------------------------------------------------------------- +Thu Jun 29 07:00:11 UTC 2023 - Andreas Schneider + +- Update to version 1.11 + * Update to SWIG 4.1.1 + * Require Graphviz 2.46+ + * Fix passthrough of graph attributes when copying + * Update install instructions + +------------------------------------------------------------------- +Tue Jun 13 11:10:33 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Thu Feb 23 10:53:13 UTC 2023 - Daniel Garcia + +- Add test_drawing_png_output_with_NULL_smoketest to the list of tests + to skip because missing png support. gh#pygraphviz/pygraphviz#366 + +------------------------------------------------------------------- +Fri Feb 17 22:02:46 UTC 2023 - Dirk Müller + +- fix dependencies for distros older than tumbleweed + +------------------------------------------------------------------- +Sun Aug 14 15:16:00 UTC 2022 - Arun Persaud + +- specfile: + * update copyright year + +- update to version 1.9: + * Drop Python 3.7 support + * Add Python 3.10 support + * Add osage and patchwork to progs list + * Add IPython rich display hook to AGraph class + * Add contributor guide + * Fixed directed nature of AGraph.copy() + * Minor documentation and code fixes + +------------------------------------------------------------------- +Tue Oct 19 19:58:44 UTC 2021 - Matej Cepl + +- Update to 1.7: + - Drop Python 3.6 support + - Add Python 3.9 support + - Require Graphviz 2.42+, (Graphviz 2.46+ recommended) + - Improve installation process and documentation + - Switch from nose to pytest + - Remove old Python 2 code + - AGraph.eq includes attribute comparison (PR #246) + +------------------------------------------------------------------- +Mon Sep 28 11:16:38 UTC 2020 - Dirk Mueller + +- update to 1.6: + - Add Python 3.8 support + - Drop Python 2.7 support + - Update to SWIG 4.0.1 + +------------------------------------------------------------------- +Tue May 14 14:40:16 UTC 2019 - Marketa Calabkova + +- Update to 1.5 + * Python 3.7 support + +------------------------------------------------------------------- +Sun Aug 6 04:42:26 UTC 2017 - toddrme2178@gmail.com + +- Fix shebangs + +------------------------------------------------------------------- +Wed May 17 21:43:00 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version +- Fix source URL +- Update to version 1.4rc1 + * No upstream changelog + +------------------------------------------------------------------- +Wed Jun 15 17:11:49 UTC 2016 - toddrme2178@gmail.com + +- Update to 1.3.1 + - Update manifest to include missing files +- Update to 1.3 + - Python 3 support + - Encoding bugfixes +- Rebase docdir.patch + +------------------------------------------------------------------- +Fri Mar 28 14:42:59 UTC 2014 - speilicke@suse.com + +- Set license to BSD-3-Clause according to legal + +------------------------------------------------------------------- +Fri Dec 6 13:44:13 UTC 2013 - toddrme2178@gmail.com + +- Update to 1.2 + * Quote Graphviz program names to work with space (Windows fix) + * Keep name in reverse() +- Require graphviz-python + +------------------------------------------------------------------- +Wed May 23 11:06:26 UTC 2012 - toddrme2178@gmail.com + +- Clean up spec file +- Update to version 1.1 + * Added unicode support for handling non-ASCII characters + * Better handling of user data on initialization of AGraph() object to guess input type (AGraph object, file, dict-of-dicts, file) + * Add sfdp to layout options +- Update to version 1..0.0 + * Added to_string() and from_string methods + * Interface to graphviz “acyclic” and “tred” + * Better handling of user data on initialization of AGraph() object to guess input type (AGraph object, file, dict-of-dicts, file) + * Add handling of default attributes for subgraphs + * Improved error handling when using non-string data + * Fix bug in default attribute handling + * Make sure file handles are closed correctly + +------------------------------------------------------------------- +Sat Mar 26 03:45:26 UTC 2011 - alexandre@exatati.com.br + +- Regenerate spec file with py2pack; +- Bzip2 source code; +- Add docdir.patch to fix documentation path. + +------------------------------------------------------------------- +Fri Oct 9 01:03:40 UTC 2009 - alexandre@exatati.com.br + +- Initial package (0.99.1) for openSUSE. diff --git a/python-pygraphviz.spec b/python-pygraphviz.spec new file mode 100644 index 0000000..9dfcd7b --- /dev/null +++ b/python-pygraphviz.spec @@ -0,0 +1,129 @@ +# +# spec file for package python-pygraphviz +# +# Copyright (c) 2025 SUSE LLC and contributors +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "doc" +%define psuffix -doc +%bcond_without doc +%else +%define psuffix %{nil} +%bcond_with doc +%endif +%{?sle15_python_module_pythons} +Name: python-pygraphviz%{psuffix} +Version: 1.14 +Release: 0 +Summary: Python interface to Graphviz +License: BSD-3-Clause +URL: https://github.com/pygraphviz/pygraphviz +Source: https://files.pythonhosted.org/packages/source/p/pygraphviz/pygraphviz-%{version}.tar.gz +# https://github.com/pygraphviz/pygraphviz/issues/532 +Source1: https://raw.githubusercontent.com/pygraphviz/pygraphviz/main/examples/README.txt +# PATCH-FIX-UPSTREAM graphviz_14-0-0.patch bsc#1252488 mcepl@suse.com +# make the code compatible with gvRenderData signature from graphviz 14.0.* +Patch0: graphviz_14-0-0.patch +BuildRequires: %{python_module devel >= 3.10} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: graphviz-devel >= 2.42 +BuildRequires: graphviz-gd +BuildRequires: libpng-devel +BuildRequires: python-rpm-macros +%if %{with doc} +BuildRequires: %{python_module Sphinx} +BuildRequires: %{python_module matplotlib} +BuildRequires: %{python_module numpydoc} +BuildRequires: %{python_module pydata-sphinx-theme} +BuildRequires: %{python_module pygraphviz = %{version}} +BuildRequires: %{python_module sphinx-gallery} +BuildArch: noarch +%endif +BuildRequires: swig +Requires: graphviz >= 2.42 +%if 0%{?suse_version} >= 1550 +BuildRequires: pkgconf-pkg-config +%endif +%python_subpackages + +%description +A Python wrapper for the Graphviz Agraph data structure. +PyGraphviz can be used to create and draw networks and graphs with Graphviz. + +%package -n %{name}-doc +Summary: Documentation for %{name} +Provides: %{python_module pygraphviz-doc = %{version}} + +%description -n %{name}-doc +This package provides documentation and help files for %{name} + +%prep +%autosetup -p1 -n pygraphviz-%{version} +cp %SOURCE1 examples + +# Remove generated C file to force regeneration from SWIG sources +rm pygraphviz/graphviz_wrap.c + +%build +export CFLAGS="%{optflags}" +%if ! %{with doc} +%pyproject_wheel +%else +make -C doc html +%endif + +%install +export CFLAGS="%{optflags}" +%if ! %{with doc} +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} +%else +mkdir -p %{buildroot}%{_docdir}/pygraphviz-%{version} +cp -ar doc/build/html/* %{buildroot}%{_docdir}/pygraphviz-%{version} +%endif + +%if ! %{with doc} +%check +# We don't want to run the tests from the topdir +tmpdir=$(mktemp -d) +cp pygraphviz/tests/* $tmpdir +pushd $tmpdir +# skip tests because of gh#pygraphviz/pygraphviz#366 +donttest="test_drawing_makes_file or test_drawing_makes_file1 or test_drawing_makes_file or test_drawing_png_output_with_NULL_smoketest" +%pytest_arch -k "not ($donttest)" +popd +rm -rf $tmpdir +%endif + +%if ! %{with doc} +%files %{python_files} +%license LICENSE +%doc README.rst +%{python_sitearch}/pygraphviz +%{python_sitearch}/pygraphviz-%{version}.dist-info +%endif + +%if %{with doc} +%files -n %{name} +%license LICENSE +%{_docdir}/pygraphviz-%{version} +%endif + +%changelog From 4eb6f121f198de844aaf2addc92bb3c91efd071f472840c47dd21be98f484863 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 22 Oct 2025 22:47:36 +0000 Subject: [PATCH 2/3] Update the patch. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pygraphviz?expand=0&rev=37 --- graphviz_14-0-0.patch | 66 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/graphviz_14-0-0.patch b/graphviz_14-0-0.patch index 062d722..61e41c0 100644 --- a/graphviz_14-0-0.patch +++ b/graphviz_14-0-0.patch @@ -1,35 +1,75 @@ --- - pygraphviz/graphviz.i | 4 ++-- - setup.py | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) + pygraphviz/graphviz.i | 5 +++++ + setup.py | 41 +++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 44 insertions(+), 2 deletions(-) Index: pygraphviz-1.14/pygraphviz/graphviz.i =================================================================== --- pygraphviz-1.14.orig/pygraphviz/graphviz.i 2024-09-29 20:31:00.000000000 +0200 -+++ pygraphviz-1.14/pygraphviz/graphviz.i 2025-10-22 19:43:41.606164205 +0200 -@@ -338,7 +338,7 @@ ++++ pygraphviz-1.14/pygraphviz/graphviz.i 2025-10-23 00:14:21.676670665 +0200 +@@ -338,7 +338,12 @@ /* three lines are straight from the SWIG manual. */ %include %include --%cstring_output_allocate_size(char **result, unsigned int* size, free(*$1)); --int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, unsigned int *size); ++#if GRAPHVIZ_VERSION_MAJOR >= 14 +%cstring_output_allocate_size(char **result, size_t* size, free(*$1)); +int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, size_t *size); ++#else + %cstring_output_allocate_size(char **result, unsigned int* size, free(*$1)); + int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, unsigned int *size); ++#endif /* Free memory allocated and pointed to by *result in gvRenderData */ extern void gvFreeRenderData (char* data); Index: pygraphviz-1.14/setup.py =================================================================== --- pygraphviz-1.14.orig/setup.py 2024-09-29 20:31:00.000000000 +0200 -+++ pygraphviz-1.14/setup.py 2025-10-22 19:46:41.138483128 +0200 -@@ -2,14 +2,14 @@ ++++ pygraphviz-1.14/setup.py 2025-10-23 00:45:39.447285598 +0200 +@@ -1,15 +1,51 @@ + import sys ++import os ++import re from setuptools import setup, Extension ++def get_graphviz_version(): ++ """ ++ Reads GRAPHVIZ_VERSION_MAJOR from the header file. ++ Assumes the header is available at a known path during setup. ++ """ ++ # NOTE: You may need to adjust this path based on your environment ++ # or rely on the build system to have already installed it. ++ header_path = '/usr/include/graphviz/graphviz_version.h' ++ ++ if not os.path.exists(header_path): ++ # Fallback/default if header file cannot be read during setup. ++ # This should match your expected target version. ++ raise RuntimeError(f"Graphviz header file not found at {header_path}.") ++ ++ with open(header_path, 'r') as f: ++ content = f.read() ++ match = re.search(r'#define\s+GRAPHVIZ_VERSION_MAJOR\s+(\d+)', content) ++ if match: ++ return int(match.group(1)) ++ else: ++ match = re.search(r'#define\s+PACKAGE_VERSION\s+"([0-9.]+)"', content) ++ if match: ++ maj_ver = match.group(1).split('.')[0] ++ return int(maj_ver) ++ ++ raise RuntimeError(f"GRAPHVIZ_VERSION_MAJOR macro not found in the header file!") ++ if __name__ == "__main__": - define_macros = [("SWIG_PYTHON_STRICT_BYTE_CHAR", None)] ++ # Get the target version number ++ gv_major_version = get_graphviz_version() ++ + define_macros = [] ++ swig_options = [] if sys.platform == "win32": define_macros.append(("GVDLL", None)) ++ swig_options.append("-DGRAPHVIZ_VERSION_MAJOR={}".format(str(gv_major_version))) ++ print(f"Defining GRAPHVIZ_VERSION_MAJOR as: {gv_major_version}") ++ extension = [ Extension( name="pygraphviz._graphviz", @@ -38,3 +78,11 @@ Index: pygraphviz-1.14/setup.py include_dirs=[], library_dirs=[], # cdt does not link to cgraph, whereas cgraph links to cdt. +@@ -20,6 +56,7 @@ + # undefined symbol errors. seen under PyPy on Linux.) + libraries=["cdt", "cgraph", "gvc"], + define_macros=define_macros, ++ swig_opts=swig_options, + ) + ] + From b2133b1b9e6dad31f74ce69b0478f3ba1c5fdbe3353c4220a785cdf7985fcc38 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 24 Oct 2025 16:53:54 +0000 Subject: [PATCH 3/3] =?UTF-8?q?-=20More=20gentle=20version=20of=20graphviz?= =?UTF-8?q?=5F14-0-0.patch,=20which=20doesn=E2=80=99t=20=20=20change=20a?= =?UTF-8?q?=20SWIG=20include=20file,=20just=20the=20C=20generated=20one=20?= =?UTF-8?q?with=20the=20=20=20minimal=20required=20change=20(bsc#1252488).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pygraphviz?expand=0&rev=38 --- graphviz_14-0-0.patch | 118 ++++++++++++-------------------------- python-pygraphviz.changes | 7 +++ python-pygraphviz.spec | 3 - 3 files changed, 43 insertions(+), 85 deletions(-) diff --git a/graphviz_14-0-0.patch b/graphviz_14-0-0.patch index 61e41c0..90aa1a2 100644 --- a/graphviz_14-0-0.patch +++ b/graphviz_14-0-0.patch @@ -1,88 +1,42 @@ --- - pygraphviz/graphviz.i | 5 +++++ - setup.py | 41 +++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 44 insertions(+), 2 deletions(-) + pygraphviz/graphviz_wrap.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) -Index: pygraphviz-1.14/pygraphviz/graphviz.i +Index: pygraphviz-1.14/pygraphviz/graphviz_wrap.c =================================================================== ---- pygraphviz-1.14.orig/pygraphviz/graphviz.i 2024-09-29 20:31:00.000000000 +0200 -+++ pygraphviz-1.14/pygraphviz/graphviz.i 2025-10-23 00:14:21.676670665 +0200 -@@ -338,7 +338,12 @@ - /* three lines are straight from the SWIG manual. */ - %include - %include -+#if GRAPHVIZ_VERSION_MAJOR >= 14 -+%cstring_output_allocate_size(char **result, size_t* size, free(*$1)); -+int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, size_t *size); -+#else - %cstring_output_allocate_size(char **result, unsigned int* size, free(*$1)); - int gvRenderData(GVC_t *gvc, Agraph_t* g, char *format, char **result, unsigned int *size); +--- pygraphviz-1.14.orig/pygraphviz/graphviz_wrap.c 2024-09-29 20:31:00.000000000 +0200 ++++ pygraphviz-1.14/pygraphviz/graphviz_wrap.c 2025-10-24 18:49:18.399642610 +0200 +@@ -3022,6 +3022,11 @@ + + #include "graphviz/cgraph.h" + #include "graphviz/gvc.h" ++#include "graphviz/graphviz_version.h" ++ ++#ifndef GRAPHVIZ_VERSION_MAJOR ++#define GRAPHVIZ_VERSION_MAJOR 12 +#endif - /* Free memory allocated and pointed to by *result in gvRenderData */ - extern void gvFreeRenderData (char* data); -Index: pygraphviz-1.14/setup.py -=================================================================== ---- pygraphviz-1.14.orig/setup.py 2024-09-29 20:31:00.000000000 +0200 -+++ pygraphviz-1.14/setup.py 2025-10-23 00:45:39.447285598 +0200 -@@ -1,15 +1,51 @@ - import sys -+import os -+import re - from setuptools import setup, Extension -+def get_graphviz_version(): -+ """ -+ Reads GRAPHVIZ_VERSION_MAJOR from the header file. -+ Assumes the header is available at a known path during setup. -+ """ -+ # NOTE: You may need to adjust this path based on your environment -+ # or rely on the build system to have already installed it. -+ header_path = '/usr/include/graphviz/graphviz_version.h' -+ -+ if not os.path.exists(header_path): -+ # Fallback/default if header file cannot be read during setup. -+ # This should match your expected target version. -+ raise RuntimeError(f"Graphviz header file not found at {header_path}.") -+ -+ with open(header_path, 'r') as f: -+ content = f.read() -+ match = re.search(r'#define\s+GRAPHVIZ_VERSION_MAJOR\s+(\d+)', content) -+ if match: -+ return int(match.group(1)) -+ else: -+ match = re.search(r'#define\s+PACKAGE_VERSION\s+"([0-9.]+)"', content) -+ if match: -+ maj_ver = match.group(1).split('.')[0] -+ return int(maj_ver) -+ -+ raise RuntimeError(f"GRAPHVIZ_VERSION_MAJOR macro not found in the header file!") -+ - if __name__ == "__main__": -- define_macros = [("SWIG_PYTHON_STRICT_BYTE_CHAR", None)] -+ # Get the target version number -+ gv_major_version = get_graphviz_version() -+ -+ define_macros = [] -+ swig_options = [] - if sys.platform == "win32": - define_macros.append(("GVDLL", None)) - -+ swig_options.append("-DGRAPHVIZ_VERSION_MAJOR={}".format(str(gv_major_version))) -+ print(f"Defining GRAPHVIZ_VERSION_MAJOR as: {gv_major_version}") -+ - extension = [ - Extension( - name="pygraphviz._graphviz", -- sources=["pygraphviz/graphviz_wrap.c"], -+ sources=["pygraphviz/graphviz.i"], - include_dirs=[], - library_dirs=[], - # cdt does not link to cgraph, whereas cgraph links to cdt. -@@ -20,6 +56,7 @@ - # undefined symbol errors. seen under PyPy on Linux.) - libraries=["cdt", "cgraph", "gvc"], - define_macros=define_macros, -+ swig_opts=swig_options, - ) - ] + SWIGINTERN swig_type_info* +@@ -5447,7 +5452,13 @@ + Agraph_t *arg2 = (Agraph_t *) 0 ; + char *arg3 = (char *) 0 ; + char **arg4 = (char **) 0 ; ++#if GRAPHVIZ_VERSION_MAJOR >= 14 ++ size_t *arg5 = (size_t *) 0 ; ++ size_t tempn4 ; ++#else + unsigned int *arg5 = (unsigned int *) 0 ; ++ unsigned int tempn4 ; ++#endif + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; +@@ -5456,7 +5467,6 @@ + char *buf3 = 0 ; + int alloc3 = 0 ; + char *temp4 = 0 ; +- unsigned int tempn4 ; + PyObject *swig_obj[3] ; + int result; + diff --git a/python-pygraphviz.changes b/python-pygraphviz.changes index a3480e4..d592074 100644 --- a/python-pygraphviz.changes +++ b/python-pygraphviz.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 24 16:52:44 UTC 2025 - Matej Cepl + +- More gentle version of graphviz_14-0-0.patch, which doesn’t + change a SWIG include file, just the C generated one with the + minimal required change (bsc#1252488). + ------------------------------------------------------------------- Wed Oct 22 17:55:37 UTC 2025 - Matej Cepl diff --git a/python-pygraphviz.spec b/python-pygraphviz.spec index 9dfcd7b..d5e7cb7 100644 --- a/python-pygraphviz.spec +++ b/python-pygraphviz.spec @@ -78,9 +78,6 @@ This package provides documentation and help files for %{name} %autosetup -p1 -n pygraphviz-%{version} cp %SOURCE1 examples -# Remove generated C file to force regeneration from SWIG sources -rm pygraphviz/graphviz_wrap.c - %build export CFLAGS="%{optflags}" %if ! %{with doc}