Phillip Smyth pushed to branch mandatory_suffix at BuildStream / buildstream
Commits:
- 
051e725f
by Phillip Smyth at 2018-11-22T11:51:55Z
2 changed files:
Changes:
| ... | ... | @@ -562,7 +562,9 @@ def show(app, elements, deps, except_, order, format_, all_): | 
| 562 | 562 |          sys.exit(-1)
 | 
| 563 | 563 |  | 
| 564 | 564 |      if all_:
 | 
| 565 | -        elements = get_files("elements")
 | |
| 565 | +        project_file = os.path.join(app._main_options.get("directory"), "project.conf")
 | |
| 566 | +        project = _yaml.load(project_file)
 | |
| 567 | +        elements = get_files(project.get('element-path'))
 | |
| 566 | 568 |  | 
| 567 | 569 |      with app.initialized():
 | 
| 568 | 570 |          dependencies = app.stream.load_selection(elements,
 | 
| ... | ... | @@ -97,7 +97,13 @@ class Loader(): | 
| 97 | 97 |      # Returns: The toplevel LoadElement
 | 
| 98 | 98 |      def load(self, targets, rewritable=False, ticker=None, fetch_subprojects=False):
 | 
| 99 | 99 |  | 
| 100 | +        invalid_file_extension = False
 | |
| 101 | +        invalid_files = []
 | |
| 100 | 102 |          for filename in targets:
 | 
| 103 | +            if not filename.endswith(".bst"):
 | |
| 104 | +                invalid_file_extension = True
 | |
| 105 | +                invalid_files.append(filename)
 | |
| 106 | + | |
| 101 | 107 |              if os.path.isabs(filename):
 | 
| 102 | 108 |                  # XXX Should this just be an assertion ?
 | 
| 103 | 109 |                  # Expect that the caller gives us the right thing at least ?
 | 
| ... | ... | @@ -106,6 +112,13 @@ class Loader(): | 
| 106 | 112 |                                  "path to the base project directory: {}"
 | 
| 107 | 113 |                                  .format(filename, self._basedir))
 | 
| 108 | 114 |  | 
| 115 | +        if invalid_file_extension:
 | |
| 116 | +            raise LoadError(LoadErrorReason.INVALID_DATA,
 | |
| 117 | +                            "Target elements '{}' do not have expected file extension `.bst`\n"
 | |
| 118 | +                            "Improperly named elements will not be discoverable by commands"
 | |
| 119 | +                            .format(invalid_files))
 | |
| 120 | + | |
| 121 | + | |
| 109 | 122 |          # First pass, recursively load files and populate our table of LoadElements
 | 
| 110 | 123 |          #
 | 
| 111 | 124 |          deps = []
 | 
