App.get_libname(): Don't use get_proj_refs() #7
2 changed files with 36 additions and 40 deletions
|
|
@ -188,27 +188,28 @@ class App(Base):
|
||||||
buf.append(spec)
|
buf.append(spec)
|
||||||
return
|
return
|
||||||
visited.add(spec)
|
visited.add(spec)
|
||||||
deps = self.get_value(name, section, key)
|
vals = self.get_value(name, section, key)
|
||||||
log(
|
log(
|
||||||
DEBUG,
|
DEBUG,
|
||||||
(
|
(
|
||||||
f'name={name}, section={section}, key={key}, deps={deps}, '
|
f'name={name}, section={section}, key={key}, deps={vals}, '
|
||||||
f'scope={scope.name}, visited={visited}'
|
f'scope={scope.name}, visited={visited}'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if deps and scope != Scope.Self:
|
vals_list = vals.split(',') if vals else []
|
||||||
if scope == Scope.One:
|
match scope:
|
||||||
subscope = Scope.Self
|
case Scope.Self:
|
||||||
else:
|
buf += vals_list
|
||||||
subscope = Scope.Subtree
|
case Scope.One | Scope.Subtree:
|
||||||
for dep in deps.split(','):
|
subscope = scope.Self if scope == Scope.One else scope
|
||||||
dep = dep.strip()
|
for val in vals_list:
|
||||||
if not (len(dep)):
|
val = val.strip()
|
||||||
|
if not (len(val)):
|
||||||
continue
|
continue
|
||||||
self.__get_project_refs_cached(
|
self.__get_project_refs_cached(
|
||||||
buf,
|
buf,
|
||||||
visited,
|
visited,
|
||||||
dep,
|
val,
|
||||||
section,
|
section,
|
||||||
key,
|
key,
|
||||||
add_self = True,
|
add_self = True,
|
||||||
|
|
@ -638,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,8 +69,9 @@ 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:
|
||||||
|
continue
|
||||||
out.append('-l' + libname)
|
out.append('-l' + libname)
|
||||||
if not out:
|
if not out:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue