Skip to content

Commit

Permalink
Deprecate conda_build.utils.relative
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Oct 18, 2023
1 parent f7cf445 commit a237b46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
13 changes: 1 addition & 12 deletions conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

import libarchive

from .deprecations import deprecated

try:
from json.decoder import JSONDecodeError
except ImportError:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a237b46

Please sign in to comment.