Skip to content
Snippets Groups Projects
Commit 637d8f64 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Fixed bug in build_packages that would report package not valid when building...

Fixed bug in build_packages that would report package not valid when building it for the first time.
parent d35ecca0
No related branches found
No related tags found
No related merge requests found
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):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment