[Notes] [Git][BuildStream/buildstream][aevri/prompt-config] Add prompt.auto-init-on-unresolved-project option



Title: GitLab

Angelos Evripiotis pushed to branch aevri/prompt-config at BuildStream / buildstream

Commits:

4 changed files:

Changes:

  • NEWS
    ... ... @@ -31,6 +31,11 @@ buildstream 1.3.1
    31 31
         new the `conf-root` variable to make the process easier. And there has been
    
    32 32
         a bug fix to workspaces so they can be build in workspaces too.
    
    33 33
     
    
    34
    +  o The buildstream.conf file learned a new 'prompt.auto-init' option. This
    
    35
    +    allows users to suppress prompts for automatically running 'bst init' if we
    
    36
    +    were unable to resolve the project.
    
    37
    +
    
    38
    +
    
    34 39
     =================
    
    35 40
     buildstream 1.1.5
    
    36 41
     =================
    

  • buildstream/_context.py
    ... ... @@ -104,6 +104,10 @@ class Context():
    104 104
             # What to do when a build fails in non interactive mode
    
    105 105
             self.sched_error_action = 'continue'
    
    106 106
     
    
    107
    +        # Whether to offer to create a project for the user, if we are invoked
    
    108
    +        # outside of a directory where we can resolve the project.
    
    109
    +        self.prompt_auto_init = True
    
    110
    +
    
    107 111
             # Whether elements must be rebuilt when their dependencies have changed
    
    108 112
             self._strict_build_plan = None
    
    109 113
     
    
    ... ... @@ -160,7 +164,7 @@ class Context():
    160 164
             _yaml.node_validate(defaults, [
    
    161 165
                 'sourcedir', 'builddir', 'artifactdir', 'logdir',
    
    162 166
                 'scheduler', 'artifacts', 'logging', 'projects',
    
    163
    -            'cache'
    
    167
    +            'cache', 'prompt'
    
    164 168
             ])
    
    165 169
     
    
    166 170
             for directory in ['sourcedir', 'builddir', 'artifactdir', 'logdir']:
    
    ... ... @@ -212,6 +216,13 @@ class Context():
    212 216
             self.sched_pushers = _yaml.node_get(scheduler, int, 'pushers')
    
    213 217
             self.sched_network_retries = _yaml.node_get(scheduler, int, 'network-retries')
    
    214 218
     
    
    219
    +        # Load prompt preferences
    
    220
    +        prompt = _yaml.node_get(
    
    221
    +            defaults, Mapping, 'prompt')
    
    222
    +        _yaml.node_validate(prompt, ['auto-init'])
    
    223
    +        self.prompt_auto_init = _yaml.node_get(
    
    224
    +            prompt, bool, 'auto-init')
    
    225
    +
    
    215 226
             # Load per-projects overrides
    
    216 227
             self._project_overrides = _yaml.node_get(defaults, Mapping, 'projects', default_value={})
    
    217 228
     
    

  • buildstream/_frontend/app.py
    ... ... @@ -222,9 +222,10 @@ class App():
    222 222
                 # Let's automatically start a `bst init` session in this case
    
    223 223
                 if e.reason == LoadErrorReason.MISSING_PROJECT_CONF and self.interactive:
    
    224 224
                     click.echo("A project was not detected in the directory: {}".format(directory), err=True)
    
    225
    -                click.echo("", err=True)
    
    226
    -                if click.confirm("Would you like to create a new project here ?"):
    
    227
    -                    self.init_project(None)
    
    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)
    
    228 229
     
    
    229 230
                 self._error_exit(e, "Error loading project")
    
    230 231
     
    

  • buildstream/data/userconfig.yaml
    ... ... @@ -97,3 +97,11 @@ logging:
    97 97
     
    
    98 98
         [%{elapsed}][%{key}][%{element}] %{action} %{message}
    
    99 99
     
    
    100
    +#
    
    101
    +# Prompts we may present to the user
    
    102
    +#
    
    103
    +
    
    104
    +prompt:
    
    105
    +  # Whether to offer to create a project, if we are invoked outside of a
    
    106
    +  # directory where we can resolve the project.
    
    107
    +  auto-init: True



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