mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
jw.pkg.App.get_modules_from_project_txt(): Add Scope
Add the Enum "Scope" to denote the scope argument of jw.pkg.App.get_modules_from_project_txt(), because it explains itself better than an integer. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
bf4834085e
commit
f6ed191d73
11 changed files with 36 additions and 24 deletions
|
|
@ -6,6 +6,7 @@ from functools import lru_cache
|
|||
|
||||
from ...lib.log import *
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdBuild(Cmd): # export
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ class CmdBuild(Cmd): # export
|
|||
dep_cache[prereq_type]: dict[str, str] = {}
|
||||
|
||||
ret = self.app.get_modules_from_project_txt([ cur ], ['pkg.requires.jw'],
|
||||
prereq_type, scope = 2, add_self=False, names_only=True)
|
||||
prereq_type, scope = Scope.Subtree, add_self=False, names_only=True)
|
||||
log(DEBUG, 'prerequisites = ' + ' '.join(ret))
|
||||
if cur in ret:
|
||||
ret.remove(cur)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdCflags(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdCflags(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'build',
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
out = []
|
||||
for m in reversed(deps):
|
||||
path = self.app.find_dir(m, ['/include'])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdExepath(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdExepath(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build', 'devel' ],
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
out = []
|
||||
for m in deps:
|
||||
path = self.app.find_dir(m, ['/bin'])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdLdflags(Cmd): # export
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class CmdLdflags(Cmd): # export
|
|||
# -L needs to contain more paths than libs linked with -l would require
|
||||
def __get_ldpathflags(self, names: list[str], exclude: list[str] = []) -> str:
|
||||
deps = self.app.get_modules_from_project_txt(names, ['pkg.requires.jw'], 'build',
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
ret = []
|
||||
for m in deps:
|
||||
if m in exclude:
|
||||
|
|
@ -37,7 +38,7 @@ class CmdLdflags(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'build',
|
||||
scope = 1, add_self=args.add_self, names_only=True)
|
||||
scope = Scope.One, add_self=args.add_self, names_only=True)
|
||||
out = []
|
||||
for m in reversed(deps):
|
||||
if m in args.exclude:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdLdlibpath(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdLdlibpath(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build', 'devel' ],
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
out = []
|
||||
for m in deps:
|
||||
path = self.app.find_dir(m, ['/lib'])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdPath(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdPath(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'run',
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
out = []
|
||||
for m in deps:
|
||||
path = self.app.find_dir(m, '/bin')
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
# TODO: seems at least partly redundant to CmdPkgRequires / print_pkg_relations
|
||||
class CmdPrereq(Cmd): # export
|
||||
|
|
@ -17,5 +18,5 @@ class CmdPrereq(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'],
|
||||
args.flavour, scope = 2, add_self=False, names_only=True)
|
||||
args.flavour, scope = Scope.Subtree, add_self=False, names_only=True)
|
||||
print(' '.join(deps))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdPythonpath(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdPythonpath(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build' ],
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
out = []
|
||||
for m in deps:
|
||||
path = self.app.find_dir(m, ['src/python', 'tools/python'])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from argparse import Namespace, ArgumentParser
|
||||
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
class CmdPythonpathOrig(Cmd): # export
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CmdPythonpathOrig(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build' ],
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
r = ''
|
||||
for m in deps:
|
||||
pd = self.app.find_dir(m, pretty=False)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from argparse import Namespace, ArgumentParser
|
|||
|
||||
from ...lib.log import *
|
||||
from ..Cmd import Cmd
|
||||
from ...App import Scope
|
||||
|
||||
# TODO: seems at least partly redundant to CmdPkgRequires / print_pkg_relations
|
||||
class CmdRequiredOsPkg(Cmd): # export
|
||||
|
|
@ -26,7 +27,7 @@ class CmdRequiredOsPkg(Cmd): # export
|
|||
flavours.append('run')
|
||||
log(DEBUG, "flavours = " + args.flavours)
|
||||
deps = self.app.get_modules_from_project_txt(modules, ['pkg.requires.jw'], flavours,
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
scope = Scope.Subtree, add_self=True, names_only=True)
|
||||
if args.skip_excluded:
|
||||
for d in deps:
|
||||
if self.app.is_excluded_from_build(d) is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue