Skip to content

Commit

Permalink
TriBITSPub#386: - hopefully fixed symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinwrobel1986 committed Jun 30, 2021
1 parent fdf13c6 commit 34f59cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tribits/doc/sphinx/sphinx_rst_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from shutil import copyfile
import subprocess
import sys

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 34f59cb

Please sign in to comment.