diff --git a/conda_build/post.py b/conda_build/post.py index 290779385d..0695028fd2 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -618,18 +618,7 @@ def mk_relative_linux(f, prefix, rpaths=("lib",), method=None): for rpath in rpaths: if rpath != "": if not rpath.startswith("/"): - # IMHO utils.relative shouldn't exist, but I am too paranoid to remove - # it, so instead, make sure that what I think it should be replaced by - # gives the same result and assert if not. Yeah, I am a chicken. - rel_ours = normpath(utils.relative(f, rpath)) - rel_stdlib = normpath(relpath(rpath, dirname(f))) - if not rel_ours == rel_stdlib: - raise ValueError( - "utils.relative {} and relpath {} disagree for {}, {}".format( - rel_ours, rel_stdlib, f, rpath - ) - ) - rpath = "$ORIGIN/" + rel_stdlib + rpath = "$ORIGIN/" + normpath(relpath(rpath, dirname(f))) if rpath not in new: new.append(rpath) rpath = ":".join(new) diff --git a/conda_build/utils.py b/conda_build/utils.py index 06a5c79c6d..aa26c4d6d5 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -38,6 +38,8 @@ import libarchive +from .deprecations import deprecated + try: from json.decoder import JSONDecodeError except ImportError: @@ -788,6 +790,11 @@ def get_conda_operation_locks(locking=True, bldpkgs_dirs=None, timeout=900): return locks +@deprecated( + "3.28.0", + "4.0.0", + addendum="Use `os.path.relpath` or `pathlib.Path.relative_to` instead.", +) def relative(f, d="lib"): assert not f.startswith("/"), f assert not d.startswith("/"), d