diff --git a/conda_build/post.py b/conda_build/post.py index 05af50b24f..bef71e31af 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -624,18 +624,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 f8606ffe9d..4f68a7f79e 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: @@ -789,6 +791,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 diff --git a/news/5042-deprecate-relative b/news/5042-deprecate-relative new file mode 100644 index 0000000000..2061f242b2 --- /dev/null +++ b/news/5042-deprecate-relative @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* Mark `conda_build.utils.relative` as pending deprecation. Use `os.path.relpath` or `pathlib.Path.relative_to` instead. (#5042) + +### Docs + +* + +### Other + +*