Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate conda_build.utils.relative #5042

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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 @@ -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
Expand Down
19 changes: 19 additions & 0 deletions news/5042-deprecate-relative
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Mark `conda_build.utils.relative` as pending deprecation. Use `os.path.relpath` or `pathlib.Path.relative_to` instead. (#5042)

### Docs

* <news item>

### Other

* <news item>
Loading