From 34f59cb4c19971f1c4a4c8519d8d82f729747291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wr=C3=B3bel?= Date: Wed, 30 Jun 2021 19:15:37 +0200 Subject: [PATCH] #386: - hopefully fixed symlinks --- tribits/doc/sphinx/sphinx_rst_generator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tribits/doc/sphinx/sphinx_rst_generator.py b/tribits/doc/sphinx/sphinx_rst_generator.py index 244f685ae..0310f47d3 100644 --- a/tribits/doc/sphinx/sphinx_rst_generator.py +++ b/tribits/doc/sphinx/sphinx_rst_generator.py @@ -1,4 +1,5 @@ import os +from shutil import copyfile import subprocess import sys @@ -91,6 +92,10 @@ def change_paths_and_get_includes(self, source_file: str, src_file_path: str, st if len(splitted_line) > path_index: new_line = splitted_line[:path_index] abs_path = os.path.abspath(os.path.join(src_file_path, splitted_line[path_index])) + if os.path.islink(abs_path): + real_path = os.path.realpath(abs_path) + os.remove(abs_path) + copyfile(src=real_path, dst=abs_path, follow_symlinks=False) if self.is_rst_file(file_path=abs_path): include_file_list.add((abs_path, src_file_path)) rel_path_from_sphinx_dir = os.path.relpath(path=abs_path, start=start_path)