From a159d7650a3f05e4d2e5953e738302a0c41eb932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 6 Aug 2026 10:20:09 +0200 Subject: [PATCH] fix setup: explicitly copy symlink Newer versions of setuptools are more strict. Error that was raised: error: can't copy 'pyulog/libevents_parse': doesn't exist or not a regular file --- setup.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/setup.py b/setup.py index 00ccb5e..a063955 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,33 @@ """ +from pathlib import Path +import shutil + from setuptools import setup +from setuptools.command.build_py import build_py DOCLINES = __doc__.split("\n") +LIBEVENTS_PARSE_PACKAGE = "libevents_parse" # pylint: disable=invalid-name +class BuildPy(build_py): + + def copy_file(self, infile, outfile, *args, **kwargs): + infile = Path(infile) + resolved = infile.resolve() + + if infile.name == LIBEVENTS_PARSE_PACKAGE and resolved.is_dir(): + # Copy libevents_parse as setuptools does not allow to copy the symlink + shutil.copytree(resolved, outfile, dirs_exist_ok=True) + return str(outfile), True + + return super().copy_file(infile, outfile, *args, **kwargs) + setup( long_description="\n".join(DOCLINES), long_description_content_type='text/x-rst', platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], + cmdclass={"build_py": BuildPy}, )