Skip to content

Commit c37d96f

Browse files
committed
simplify skip logic
1 parent a27be4e commit c37d96f

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

vinca/resolve.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,28 @@ def resolve_pkgname_from_indexes(pkg_shortname, conda_index):
4545
return None
4646

4747

48+
def should_skip_pkg(pkg_shortname, vinca_conf):
49+
skip = vinca_conf.get("packages_remove_from_deps", [])
50+
if not skip:
51+
return False
52+
53+
if pkg_shortname in skip:
54+
return True
55+
if pkg_shortname.replace('_', '-') in skip:
56+
return True
57+
4858
def resolve_pkgname(pkg_shortname, vinca_conf, distro, is_rundep=False):
4959
pkg_names = resolve_pkgname_from_indexes(
5060
pkg_shortname, vinca_conf["_conda_indexes"]
5161
)
5262
if pkg_names is None:
53-
if not distro.check_package(pkg_shortname):
63+
if not distro.check_package(pkg_shortname) or should_skip_pkg(pkg_shortname, vinca_conf):
5464
return []
5565
else:
56-
if (
57-
"packages_remove_from_deps" in vinca_conf
58-
and vinca_conf["packages_remove_from_deps"] is not None
59-
and not (
60-
pkg_shortname.replace("_", "-") in vinca_conf["packages_remove_from_deps"] or
61-
pkg_shortname in vinca_conf["packages_remove_from_deps"])
62-
):
63-
return [
64-
"ros-%s-%s"
65-
% (vinca_conf["ros_distro"], pkg_shortname.replace("_", "-"))
66-
]
67-
else:
68-
return []
66+
return [
67+
"ros-%s-%s"
68+
% (vinca_conf["ros_distro"], pkg_shortname.replace("_", "-"))
69+
]
6970
else:
7071
if is_rundep: # for run dependencies, remove the version
7172
pkg_names_pinned = []

0 commit comments

Comments
 (0)