mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
fix: nodejs: bin-linking: account for broken symlinks when checking for existance
This commit is contained in:
parent
a015a05db4
commit
877b83654f
@ -405,13 +405,17 @@
|
||||
for dep in ${l.toString nodeDeps}; do
|
||||
binDir=$dep/lib/node_modules/.bin
|
||||
if [ -e $binDir ]; then
|
||||
for bin in $(ls $binDir/); do
|
||||
mkdir -p $nodeModules/.bin
|
||||
for bin in $(ls $binDir/); do\
|
||||
if [ ! -e $nodeModules/.bin ]; then
|
||||
mkdir -p $nodeModules/.bin
|
||||
fi
|
||||
|
||||
# symlink might have been already created by install-deps.py
|
||||
# if installMethod=copy was selected
|
||||
if [ ! -e $nodeModules/.bin/$bin ]; then
|
||||
if [ ! -L $nodeModules/.bin/$bin ]; then
|
||||
ln -s $binDir/$bin $nodeModules/.bin/$bin
|
||||
else
|
||||
echo "won't overwrite existing symlink $nodeModules/.bin/$bin. current target: $(readlink $nodeModules/.bin/$bin)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -111,9 +111,9 @@ def symlink_bin(bin_dir, package_location, package_json, force=False):
|
||||
pathlib.Path(sourceDir).mkdir(parents=True, exist_ok=True)
|
||||
dest = os.path.relpath(f'{package_location}/{relpath}', sourceDir)
|
||||
print(f"symlinking executable. dest: {dest}; source: {source}")
|
||||
if force and os.path.exists(source):
|
||||
if force and os.path.lexists(source):
|
||||
os.remove(source)
|
||||
if not os.path.exists(source):
|
||||
if not os.path.lexists(source):
|
||||
os.symlink(dest, source)
|
||||
|
||||
if isinstance(bin, str):
|
||||
|
@ -23,7 +23,7 @@ def symlink_bin(bin_dir, package_json):
|
||||
dest = os.path.relpath(relpath, sourceDir)
|
||||
print(f"symlinking executable. dest: {dest}; source: {source}")
|
||||
# if a bin with this name exists, overwrite
|
||||
if os.path.exists(source):
|
||||
if os.path.lexists(source):
|
||||
os.remove(source)
|
||||
os.symlink(dest, source)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user