Commit 837dcc81 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[utils][commands][intall] Refactor "project" handling

It now only tries to install projects based
on the folders inside the beat/beat.examples>.
This will avoid running through the linking
steps again and again when something is not
a project but still listed as one.
parent c8823b66
......@@ -59,6 +59,7 @@ import fnmatch
import logging
import os
import sys
from pathlib import Path
import simplejson
from django.conf import settings
......@@ -1054,13 +1055,17 @@ class Command(BaseCommand):
# gets a list of all available projects, excluding directories
ignore = ["system", "LICENSE", ".git", ".gitignore", "README.rst"]
projects = os.listdir(self.prefix)
self.projects = []
for candidate in projects:
if (candidate not in ignore) or (candidate not in projects):
# gets a list of all available projects, excluding system as this one
# shall be installed by default and before the others.
ignore = ["system"]
path = Path(self.prefix)
self.projects = [
for item in path.iterdir()
if item.is_dir()
and not".")
and not in ignore
def add_arguments(self, parser):
......@@ -1156,21 +1161,14 @@ class Command(BaseCommand):
# Checks projects
if not arguments["project"]:
arguments["project"] = ["test", "advanced"]
projects = list(set(arguments["project"]))
while "system" in arguments["project"]:
"Removing `system' from the list of projects to "
"install (this is them minimal default anyway)"
for k in arguments["project"]:
if k not in self.projects:
for project in projects:
if project not in self.projects:
"Project `%s' is not available, choose from: %s",
", ".join("`%s'" % k for k in self.projects),
......@@ -1210,8 +1208,7 @@ class Command(BaseCommand):
queue = environment.queues.first()
# Iterates over projects to install
for project in ["system"] + arguments["project"]:
for project in ["system"] + projects:
template_data = dict(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment