python: collision in names when developing 2 and more python packages with nix
when you run nix-shell 2 times at the same time of project (but different
branches) you get collision in names inside /tmp folder. i solved this by
hashing current path of developing folder and using that as indentifier while
still keeping name at the end.
diff --git a/pkgs/development/python-modules/generic/default.nix
b/pkgs/development/python-modules/generic/default.nix index 4c9c53a..6ec7934
100644 --- a/pkgs/development/python-modules/generic/default.nix +++
b/pkgs/development/python-modules/generic/default.nix @@ -161,11 +161,12 @@ if
disabled then throw "${name} not supported for interpreter ${python.executabl
shellHook = attrs.shellHook or ''
if test -e setup.py; then
- mkdir -p /tmp/$name/lib/${python.libPrefix}/site-packages
+ tmp_path=/tmp/`pwd | md5sum | cut -f 1 -d " "`-$name
+ mkdir -p $tmp_path/lib/${python.libPrefix}/site-packages
${preShellHook}
- export PATH="/tmp/$name/bin:$PATH"
- export PYTHONPATH="/tmp/$name/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
- ${python}/bin/${python.executable} setup.py develop --prefix /tmp/$name
+ export PATH="$tmp_path/bin:$PATH"
+ export PYTHONPATH="$tmp_path/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
+ ${python}/bin/${python.executable} setup.py develop --prefix $tmp_path
${postShellHook}
fi
'';
This commit is contained in:
parent
96f4a47199
commit
602f7e5aa4
@ -161,11 +161,12 @@ if disabled then throw "${name} not supported for interpreter ${python.executabl
|
||||
|
||||
shellHook = attrs.shellHook or ''
|
||||
if test -e setup.py; then
|
||||
mkdir -p /tmp/$name/lib/${python.libPrefix}/site-packages
|
||||
tmp_path=/tmp/`pwd | md5sum | cut -f 1 -d " "`-$name
|
||||
mkdir -p $tmp_path/lib/${python.libPrefix}/site-packages
|
||||
${preShellHook}
|
||||
export PATH="/tmp/$name/bin:$PATH"
|
||||
export PYTHONPATH="/tmp/$name/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
||||
${python}/bin/${python.executable} setup.py develop --prefix /tmp/$name
|
||||
export PATH="$tmp_path/bin:$PATH"
|
||||
export PYTHONPATH="$tmp_path/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
||||
${python}/bin/${python.executable} setup.py develop --prefix $tmp_path
|
||||
${postShellHook}
|
||||
fi
|
||||
'';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user