App.get_libname(): Don't use get_proj_refs()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m18s
CI / Packaging test (push) Successful in 0s
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m18s
CI / Packaging test (push) Successful in 0s
App.get_projects_refs() is a versatile tool, but what it does isn't obvious. Use the simpler method .get_value() instead for get_libname(), and return None if a project doesn't provide a linkable library.
This is similar to fix
aadcdfb5f.Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
c538447cc5
commit
3f47abb29a
2 changed files with 14 additions and 19 deletions
|
|
@ -639,20 +639,14 @@ class App(Base):
|
|||
ret.append(m)
|
||||
return ret
|
||||
|
||||
def get_libname(self, projects) -> str:
|
||||
vals = self.get_project_refs(
|
||||
projects,
|
||||
['build'],
|
||||
'libname',
|
||||
scope = Scope.One,
|
||||
add_self = False,
|
||||
names_only = True,
|
||||
)
|
||||
if not vals:
|
||||
return ' '.join(projects)
|
||||
if 'none' in vals:
|
||||
vals.remove('none')
|
||||
return ' '.join(reversed(vals))
|
||||
def get_libname(self, spec: str) -> str | None:
|
||||
project_name = self.strip_module_from_spec(spec)
|
||||
ret = self.get_value(project_name, 'build', 'libname')
|
||||
if ret == 'none':
|
||||
return None
|
||||
if ret is None:
|
||||
return project_name
|
||||
return ret
|
||||
|
||||
def is_excluded_from_build(self, project: str) -> str | None:
|
||||
log(DEBUG, 'checking if project ' + project + ' is excluded from build')
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ class CmdLdflags(Cmd): # export
|
|||
for m in deps:
|
||||
if m in exclude:
|
||||
continue
|
||||
libname = self.app.get_libname([m])
|
||||
if not len(libname):
|
||||
libname = self.app.get_libname(m)
|
||||
if libname is None:
|
||||
continue
|
||||
path = self.app.find_dir(m, ['/lib'])
|
||||
if not path:
|
||||
|
|
@ -69,8 +69,9 @@ class CmdLdflags(Cmd): # export
|
|||
for m in reversed(deps):
|
||||
if m in args.exclude:
|
||||
continue
|
||||
libname = self.app.get_libname([m])
|
||||
if len(libname):
|
||||
libname = self.app.get_libname(m)
|
||||
if libname is None:
|
||||
continue
|
||||
out.append('-l' + libname)
|
||||
if not out:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue