Let TeXFiles.py handle symbolic links.

Nix (https://nixos.org) is a Unix package manager, which can be used to
install LaTeX on macOS. A peculiarity of Nix is that all packages are
installed into separate directories and the actual directory tree is
then constructed via symlinks.

This interacts badly with the way LyX currently detects files in the
TeX setup, because TeXFiles.py does not follow symlinks. Therefore,
almost nothing is found when using LyX together with Nix’ LaTeX.

Patch from Michael Roitzsch.
This commit is contained in:
Jean-Marc Lasgouttes 2019-06-25 15:46:14 +02:00
parent 1a2b1a3bfa
commit 642b4acca1
3 changed files with 22 additions and 1 deletions

View File

@ -503,6 +503,9 @@
@bBernhard Roider @bBernhard Roider
@iE-mail: bernhard.roider () sonnenkinder ! org @iE-mail: bernhard.roider () sonnenkinder ! org
Various bug fixes Various bug fixes
@bMichael Roitzsch
@iE-mail: reactorcontrol () icloud ! com
Fixes for the Nix package manager
@bJim Rotmalm @bJim Rotmalm
@iE-mail: jim.rotmalm () gmail ! com @iE-mail: jim.rotmalm () gmail ! com
Swedish translation Swedish translation

View File

@ -1679,6 +1679,14 @@ contributors = [
"29 January 2007", "29 January 2007",
u"Various bug fixes"), u"Various bug fixes"),
contributor(u"Michael Roitzsch",
"reactorcontrol () icloud ! com",
"GPL",
"Re: TeXFiles.py compatibility with Nix on macOS",
"m=156146891826580",
"25 June 2019",
u"Fixes for the Nix package manager"),
contributor(u"Jim Rotmalm", contributor(u"Jim Rotmalm",
"jim.rotmalm () gmail ! com", "jim.rotmalm () gmail ! com",
"GPL", "GPL",

View File

@ -116,7 +116,17 @@ for type in types:
if not os.path.isdir(dir): if not os.path.isdir(dir):
continue continue
# walk down the file hierarchy # walk down the file hierarchy
for root,path,files in os.walk(dir): visited = set()
for root,dirs,files in os.walk(dir, followlinks=True):
# prevent inifinite recursion
recurse = []
for dir in dirs:
st = os.stat(os.path.join(root, dir))
key = st.st_dev, st.st_ino
if key not in visited:
visited.add(key)
recurse.append(dir)
dirs[:] = recurse
# check file type # check file type
for file in files: for file in files:
if len(file) > 4 and file[-4:] == file_ext: if len(file) > 4 and file[-4:] == file_ext: