diff --git a/scripts/projects.py b/scripts/projects.py index 65fe6662..ecaaddbb 100644 --- a/scripts/projects.py +++ b/scripts/projects.py @@ -110,6 +110,9 @@ class Projects(object): r = d + '/' + name if os.path.exists(r): return r + if os.path.exists(f'/usr/share/doc/packages/{name}/VERSION'): + # The package exists but does not have a dedicated project directory + return None raise Exception('No project path found for module "{}"'.format(name)) def re_section(self, name): @@ -142,6 +145,8 @@ class Projects(object): # TODO: add support for customizing this in project.conf def htdocs_dir(self, name): pd = self.proj_dir(name) + if pd is None: + return None for r in [ pd + "/tools/html/htdocs", pd + "/htdocs", "/srv/www/proj/" + name ]: if isdir(r): return r @@ -704,7 +709,10 @@ class Projects(object): scope = 2, add_self=True, names_only=True) r = '' for m in deps: - r = r + ':' + self.proj_dir(m) + '/lib' + pd = self.proj_dir(m) + if pd is None: + continue + r = r + ':' + pd + '/lib' print(r[1:]) def cmd_pythonpath(self, args_): @@ -715,9 +723,11 @@ class Projects(object): scope = 2, add_self=True, names_only=True) r = '' for m in deps: - pdir = self.proj_dir(m) + pd = self.proj_dir(m) + if pd is None: + continue for subdir in [ 'src/python', 'tools/python' ]: - cand = pdir + "/" + subdir + cand = pd + "/" + subdir if isdir(cand): r = r + ':' + cand print(r[1:]) @@ -731,7 +741,10 @@ class Projects(object): self.debug('deps = ', deps) r = '' for m in deps: - r = r + ':' + self.proj_dir(m) + '/bin' + pd = self.proj_dir(m) + if pd is None: + continue + r = r + ':' + pd + '/bin' print(r[1:]) def cmd_libname(self, args_): @@ -758,9 +771,12 @@ class Projects(object): r = '' for m in reversed(deps): try: - r = r + ' -I' + self.proj_dir(m) + '/include' - except: - self.warn('No include path for module "{}", ignoring'.format(m)) + pd = self.proj_dir(m) + if pd is None: + continue + r = r + ' -I' + pd + '/include' + except Exception as e: + self.warn(f'No include path for module "{m}", ignoring: {e}') print(r[1:]) def cmd_path(self, args_): @@ -771,7 +787,10 @@ class Projects(object): scope = 2, add_self=True, names_only=True) r = '' for m in deps: - r = r + ':' + self.proj_dir(m) + '/bin' + pd = self.proj_dir(m) + if pd is None: + continue + r = r + ':' + pd + '/bin' print(r[1:]) # TODO: seems at least partly redundant to cmd_pkg_requires / print_pkg_relations @@ -834,9 +853,12 @@ class Projects(object): r = [] for m in args.module: try: - r.append(self.proj_dir(m)) - except: - self.warn('No project directory for module "{}"'.format(module)) + pd = self.proj_dir(m) + if pd is None: + continue + r.append(pd) + except Exception as e: + self.warn(f'No project directory for module "{module}: {e}') continue print(' '.join(r))