[Notes] [Git][BuildStream/buildstream][aevri/rm-autoinit] 2 commits: _project::_find_project_dir: fix error message



Title: GitLab

Angelos Evripiotis pushed to branch aevri/rm-autoinit at BuildStream / buildstream

Commits:

5 changed files:

Changes:

  • NEWS
    ... ... @@ -30,6 +30,12 @@ buildstream 1.3.1
    30 30
         make changes to their .bst files if they are expecting these environment
    
    31 31
         variables to be set.
    
    32 32
     
    
    33
    +  o BREAKING CHANGE: The 'auto-init' functionality has been removed. This would
    
    34
    +    offer to create a project in the event that bst was run against a directory
    
    35
    +    without a project, to be friendly to new users. It has been replaced with
    
    36
    +    an error message and a hint instead, to avoid bothering folks that just
    
    37
    +    made a mistake.
    
    38
    +
    
    33 39
       o Failed builds are included in the cache as well.
    
    34 40
         `bst checkout` will provide anything in `%{install-root}`.
    
    35 41
         A build including cached fails will cause any dependant elements
    
    ... ... @@ -67,8 +73,8 @@ buildstream 1.3.1
    67 73
         instead of just a specially-formatted build-root with a `root` and `scratch`
    
    68 74
         subdirectory.
    
    69 75
     
    
    70
    -  o The buildstream.conf file learned new 'prompt.auto-init',
    
    71
    -    'prompt.really-workspace-close-remove-dir', and
    
    76
    +  o The buildstream.conf file learned new
    
    77
    +    'prompt.really-workspace-close-remove-dir' and
    
    72 78
         'prompt.really-workspace-reset-hard' options. These allow users to suppress
    
    73 79
         certain confirmation prompts, e.g. double-checking that the user meant to
    
    74 80
         run the command as typed.
    

  • buildstream/_context.py
    ... ... @@ -117,10 +117,6 @@ class Context():
    117 117
             # Whether or not to attempt to pull build trees globally
    
    118 118
             self.pull_buildtrees = None
    
    119 119
     
    
    120
    -        # Boolean, whether to offer to create a project for the user, if we are
    
    121
    -        # invoked outside of a directory where we can resolve the project.
    
    122
    -        self.prompt_auto_init = None
    
    123
    -
    
    124 120
             # Boolean, whether we double-check with the user that they meant to
    
    125 121
             # remove a workspace directory.
    
    126 122
             self.prompt_workspace_close_remove_dir = None
    
    ... ... @@ -258,12 +254,10 @@ class Context():
    258 254
             prompt = _yaml.node_get(
    
    259 255
                 defaults, Mapping, 'prompt')
    
    260 256
             _yaml.node_validate(prompt, [
    
    261
    -            'auto-init', 'really-workspace-close-remove-dir',
    
    257
    +            'really-workspace-close-remove-dir',
    
    262 258
                 'really-workspace-close-project-inaccessible',
    
    263 259
                 'really-workspace-reset-hard',
    
    264 260
             ])
    
    265
    -        self.prompt_auto_init = _node_get_option_str(
    
    266
    -            prompt, 'auto-init', ['ask', 'no']) == 'ask'
    
    267 261
             self.prompt_workspace_close_remove_dir = _node_get_option_str(
    
    268 262
                 prompt, 'really-workspace-close-remove-dir', ['ask', 'yes']) == 'ask'
    
    269 263
             self.prompt_workspace_close_project_inaccessible = _node_get_option_str(
    

  • buildstream/_frontend/app.py
    ... ... @@ -219,13 +219,13 @@ class App():
    219 219
                                        default_mirror=self._main_options.get('default_mirror'))
    
    220 220
             except LoadError as e:
    
    221 221
     
    
    222
    -            # Let's automatically start a `bst init` session in this case
    
    223
    -            if e.reason == LoadErrorReason.MISSING_PROJECT_CONF and self.interactive:
    
    224
    -                click.echo("A project was not detected in the directory: {}".format(directory), err=True)
    
    225
    -                if self.context.prompt_auto_init:
    
    226
    -                    click.echo("", err=True)
    
    227
    -                    if click.confirm("Would you like to create a new project here?"):
    
    228
    -                        self.init_project(None)
    
    222
    +            # Help users that are new to BuildStream by suggesting 'init'.
    
    223
    +            # We don't want to slow down users that just made a mistake, so
    
    224
    +            # don't stop them with an offer to create a project for them.
    
    225
    +            if e.reason == LoadErrorReason.MISSING_PROJECT_CONF:
    
    226
    +                click.echo("No project found. You can create a new project like so:", err=True)
    
    227
    +                click.echo("", err=True)
    
    228
    +                click.echo("    bst init", err=True)
    
    229 229
     
    
    230 230
                 self._error_exit(e, "Error loading project")
    
    231 231
     
    

  • buildstream/_project.py
    ... ... @@ -677,8 +677,9 @@ class Project():
    677 677
         #
    
    678 678
         def _find_project_dir(self, directory):
    
    679 679
             workspace_element = None
    
    680
    +        config_filenames = [_PROJECT_CONF_FILE, WORKSPACE_PROJECT_FILE]
    
    680 681
             found_directory, filename = utils._search_upward_for_files(
    
    681
    -            directory, [_PROJECT_CONF_FILE, WORKSPACE_PROJECT_FILE]
    
    682
    +            directory, config_filenames
    
    682 683
             )
    
    683 684
             if filename == _PROJECT_CONF_FILE:
    
    684 685
                 project_directory = found_directory
    
    ... ... @@ -691,8 +692,8 @@ class Project():
    691 692
             else:
    
    692 693
                 raise LoadError(
    
    693 694
                     LoadErrorReason.MISSING_PROJECT_CONF,
    
    694
    -                '{} not found in current directory or any of its parent directories'
    
    695
    -                .format(_PROJECT_CONF_FILE))
    
    695
    +                "None of {names} found in '{path}' or any of its parent directories"
    
    696
    +                .format(names=config_filenames, path=directory))
    
    696 697
     
    
    697 698
             return project_directory, workspace_element
    
    698 699
     
    

  • buildstream/data/userconfig.yaml
    ... ... @@ -112,14 +112,6 @@ logging:
    112 112
     #
    
    113 113
     prompt:
    
    114 114
     
    
    115
    -  # Whether to create a project with 'bst init' if we are invoked outside of a
    
    116
    -  # directory where we can resolve the project.
    
    117
    -  #
    
    118
    -  #  ask - Prompt the user to choose.
    
    119
    -  #  no  - Never create the project.
    
    120
    -  #
    
    121
    -  auto-init: ask
    
    122
    -
    
    123 115
       # Whether to really proceed with 'bst workspace close --remove-dir' removing
    
    124 116
       # a workspace directory, potentially losing changes.
    
    125 117
       #
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]