Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2ae101d93b |
|||
|
433fe695db |
1 changed files with 45 additions and 0 deletions
|
|
@ -98,6 +98,29 @@ class App(Base):
|
||||||
return None
|
return None
|
||||||
raise Exception('No project path found for module "{}"'.format(name))
|
raise Exception('No project path found for module "{}"'.format(name))
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def __is_installed(self, name: str, devel: bool) -> bool:
|
||||||
|
# devel: the project is in the dev tree or the -devel
|
||||||
|
# package is installed: make/project.conf is present.
|
||||||
|
# run: the -run package is installed: a VERSION file is
|
||||||
|
# present in the project directory or
|
||||||
|
# /usr/share/doc/packages.
|
||||||
|
if devel and name == self.__top_name:
|
||||||
|
# the topdir is the project's own buildable checkout
|
||||||
|
if os.path.exists(f'{self.__topdir}/make/project.conf'):
|
||||||
|
return True
|
||||||
|
search, file = (
|
||||||
|
(self.__projs_root, self.___opt_root),
|
||||||
|
'/make/project.conf'
|
||||||
|
) if devel else (
|
||||||
|
(self.__projs_root, '/usr/share/doc/packages'),
|
||||||
|
'/VERSION'
|
||||||
|
)
|
||||||
|
for root in search:
|
||||||
|
if root is not None and os.path.exists(f'{root}/{name}{file}'):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def __find_dir(
|
def __find_dir(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
|
|
@ -187,6 +210,7 @@ class App(Base):
|
||||||
names_only: bool,
|
names_only: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
name = self.strip_module_from_spec(spec)
|
name = self.strip_module_from_spec(spec)
|
||||||
|
mod = re.split('([=><]+)', spec)[0].strip()
|
||||||
if names_only:
|
if names_only:
|
||||||
spec = name
|
spec = name
|
||||||
if spec in buf:
|
if spec in buf:
|
||||||
|
|
@ -196,6 +220,15 @@ class App(Base):
|
||||||
buf.append(spec)
|
buf.append(spec)
|
||||||
return
|
return
|
||||||
visited.add(spec)
|
visited.add(spec)
|
||||||
|
needed_subpackage = 'devel' if mod.endswith(('-dev', '-devel')) else 'run'
|
||||||
|
if not self.is_installed(name, devel = True):
|
||||||
|
if not mod.endswith(('-dev', '-devel')):
|
||||||
|
if self.is_installed(name, devel = False):
|
||||||
|
return
|
||||||
|
raise Exception(
|
||||||
|
f'Unmet dependency on {mod}: the -{needed_subpackage} package '
|
||||||
|
f'of project {name} is not installed'
|
||||||
|
)
|
||||||
vals = self.get_value(name, section, key)
|
vals = self.get_value(name, section, key)
|
||||||
log(
|
log(
|
||||||
DEBUG,
|
DEBUG,
|
||||||
|
|
@ -404,6 +437,18 @@ class App(Base):
|
||||||
raise Exception('No distro object')
|
raise Exception('No distro object')
|
||||||
return self.__distro
|
return self.__distro
|
||||||
|
|
||||||
|
def is_installed(
|
||||||
|
self,
|
||||||
|
name: str,
|
||||||
|
devel: bool = False,
|
||||||
|
) -> bool:
|
||||||
|
"""True if the project is installed: for devel,
|
||||||
|
make/project.conf is present in the dev tree or /opt; for
|
||||||
|
run, a VERSION file is present in the project directory
|
||||||
|
or /usr/share/doc/packages.
|
||||||
|
"""
|
||||||
|
return self.__is_installed(name, devel)
|
||||||
|
|
||||||
def find_dir(
|
def find_dir(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue