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)
|
ret.append(m)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def get_libname(self, projects) -> str:
|
def get_libname(self, spec: str) -> str | None:
|
||||||
vals = self.get_project_refs(
|
project_name = self.strip_module_from_spec(spec)
|
||||||
projects,
|
ret = self.get_value(project_name, 'build', 'libname')
|
||||||
['build'],
|
if ret == 'none':
|
||||||
'libname',
|
return None
|
||||||
scope = Scope.One,
|
if ret is None:
|
||||||
add_self = False,
|
return project_name
|
||||||
names_only = True,
|
return ret
|
||||||
)
|
|
||||||
if not vals:
|
|
||||||
return ' '.join(projects)
|
|
||||||
if 'none' in vals:
|
|
||||||
vals.remove('none')
|
|
||||||
return ' '.join(reversed(vals))
|
|
||||||
|
|
||||||
def is_excluded_from_build(self, project: str) -> str | None:
|
def is_excluded_from_build(self, project: str) -> str | None:
|
||||||
log(DEBUG, 'checking if project ' + project + ' is excluded from build')
|
log(DEBUG, 'checking if project ' + project + ' is excluded from build')
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ class CmdLdflags(Cmd): # export
|
||||||
for m in deps:
|
for m in deps:
|
||||||
if m in exclude:
|
if m in exclude:
|
||||||
continue
|
continue
|
||||||
libname = self.app.get_libname([m])
|
libname = self.app.get_libname(m)
|
||||||
if not len(libname):
|
if libname is None:
|
||||||
continue
|
continue
|
||||||
path = self.app.find_dir(m, ['/lib'])
|
path = self.app.find_dir(m, ['/lib'])
|
||||||
if not path:
|
if not path:
|
||||||
|
|
@ -69,9 +69,10 @@ class CmdLdflags(Cmd): # export
|
||||||
for m in reversed(deps):
|
for m in reversed(deps):
|
||||||
if m in args.exclude:
|
if m in args.exclude:
|
||||||
continue
|
continue
|
||||||
libname = self.app.get_libname([m])
|
libname = self.app.get_libname(m)
|
||||||
if len(libname):
|
if libname is None:
|
||||||
out.append('-l' + libname)
|
continue
|
||||||
|
out.append('-l' + libname)
|
||||||
if not out:
|
if not out:
|
||||||
return
|
return
|
||||||
ldpathflags = self.__get_ldpathflags(args.module, args.exclude)
|
ldpathflags = self.__get_ldpathflags(args.module, args.exclude)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue