mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
utils: fix_env: dont delete LD_LIBRARY_PATH from env (#2541)
* utils: fix_env: dont delete LD_LIBRARY_PATH from env * utils: add related issue to comment on why there is empty LD_LIBRARY_PATH * Update dvc/utils/__init__.py Co-Authored-By: Ruslan Kuprieiev <[email protected]> * scm: git: move LD_LIBRARY_PATH fix to Git.clone method
This commit is contained in:
committed by
Ruslan Kuprieiev
co-authored by
Ruslan Kuprieiev
parent
f0de362e0d
commit
119548e2a1
+16
-3
@@ -8,8 +8,8 @@ import logging
|
||||
from funcy import cached_property
|
||||
|
||||
from dvc.exceptions import GitHookAlreadyExistsError
|
||||
from dvc.utils.compat import str, open
|
||||
from dvc.utils import fix_env, relpath
|
||||
from dvc.utils.compat import str, open, cast_bytes_py2
|
||||
from dvc.utils import fix_env, relpath, is_binary
|
||||
from dvc.scm.base import (
|
||||
Base,
|
||||
SCMError,
|
||||
@@ -64,11 +64,24 @@ class Git(Base):
|
||||
def clone(url, to_path, rev=None):
|
||||
import git
|
||||
|
||||
ld_key = "LD_LIBRARY_PATH"
|
||||
|
||||
env = fix_env(None)
|
||||
if is_binary() and ld_key not in env.keys():
|
||||
# In fix_env, we delete LD_LIBRARY_PATH key if it was empty before
|
||||
# PyInstaller modified it. GitPython, in git.Repo.clone_from, uses
|
||||
# env to update its own internal state. When there is no key in
|
||||
# env, this value is not updated and GitPython re-uses
|
||||
# LD_LIBRARY_PATH that has been set by PyInstaller.
|
||||
# See [1] for more info.
|
||||
# [1] https://github.com/gitpython-developers/GitPython/issues/924
|
||||
env[cast_bytes_py2(ld_key)] = ""
|
||||
|
||||
try:
|
||||
tmp_repo = git.Repo.clone_from(
|
||||
url,
|
||||
to_path,
|
||||
env=fix_env(None), # needed before we can fix it in __init__
|
||||
env=env, # needed before we can fix it in __init__
|
||||
no_single_branch=True,
|
||||
)
|
||||
tmp_repo.close()
|
||||
|
||||
Reference in New Issue
Block a user