diff --git a/build/recipes/build_pkgs/build_pkgs.py b/build/recipes/build_pkgs/build_pkgs.py index ad50462f74a3f8ed847c85e21b000e999551bdde..f542b7b3b63d112b31c109be6e3f02f4552439f3 100644 --- a/build/recipes/build_pkgs/build_pkgs.py +++ b/build/recipes/build_pkgs/build_pkgs.py @@ -1,16 +1,38 @@ import subprocess -def get_pkg_list(): +def get_dirs(): """ - Run a couple shell commands to parse the metadata directory for its packages. - :return: List of packages in metadata directory + Finds all subdirectories containing setup.py files. + :return: List of directories as strings. """ - find_proc = subprocess.run(["find", "build/metadata", - "-name", "meta.yaml"], - stdout=subprocess.PIPE) - paths = find_proc.stdout.decode('utf-8') - fmt_paths = paths.replace("build/metadata/", "").replace("/meta.yaml", "") - return fmt_paths.split('\n') + find = subprocess.run([ + 'find', '.', '-name', 'setup.py', '-not', '-path', './build/recipes/*' + ], stdout=subprocess.PIPE) + dirs = find.stdout.decode('utf-8').split('\n') + dirs_cpy = dirs + + for i, d in enumerate(dirs_cpy): + dirs[i] = d.replace('/setup.py', '') + + return dirs + +def get_names(dirs): + """ + Generate list of subproject names based on the rule that the name of the + subproject directory will be the name of the subproject. + :return: List of names as strings. + """ + names = [] + for d in dirs: + if d != '': + name = d.split('/')[-1] + + if name == "archive": + # Case with ./services/archive having special dir structure + name = "services" + names.append(name) + + return names class Recipe: def __init__(self, buildout, name, options): @@ -23,7 +45,7 @@ class Recipe: """ self.name = name self.options = options - self.pkg_list = get_pkg_list() + self.pkg_list = get_names(get_dirs()) def install(self): """