Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit unchanged options from config.toml in configure.py #108632

Merged
merged 1 commit into from
Mar 5, 2023

Conversation

Teapot4195
Copy link
Contributor

Leaves section tags, but removes options that are unchanged.
Change in config.toml.example is to prevent comments from sneaking in by being directly after a section tag

closes #108612

@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 2023

r? @ozkanonur

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 2, 2023
Comment on lines 497 to 525
# only blocks with an uncommented line will be output
block = []
has_non_comment = False
for line in targets[target]:
f.write(line + "\n")
block.append(line)
if len(line) == 0:
if has_non_comment:
for l in block:
f.write(l + "\n")
block = []
has_non_comment = False
continue
if not line.startswith('#'):
has_non_comment = True
else:
# only blocks with an uncommented line will be output
block = []
has_non_comment = False
for line in sections[section]:
f.write(line + "\n")
block.append(line)
if len(line) == 0:
if has_non_comment:
for l in block:
f.write(l + "\n")
block = []
has_non_comment = False
continue
if not line.startswith('#'):
has_non_comment = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you avoid duplicating this please? maybe with a helper function?

@@ -494,11 +494,35 @@ def configure_top_level_key(lines, top_level_key, value):
for section in section_order:
if section == 'target':
for target in targets:
# only blocks with an uncommented line will be output
block = []
has_non_comment = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
has_non_comment = False
is_comment = True

Comment on lines 501 to 514
block.append(line)
if len(line) == 0:
if has_non_comment:
for l in block:
f.write(l + "\n")
block = []
has_non_comment = False
continue
if not line.startswith('#'):
has_non_comment = True
else:
# only blocks with an uncommented line will be output
block = []
has_non_comment = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment check can be simplified with:

Suggested change
block.append(line)
if len(line) == 0:
if has_non_comment:
for l in block:
f.write(l + "\n")
block = []
has_non_comment = False
continue
if not line.startswith('#'):
has_non_comment = True
else:
# only blocks with an uncommented line will be output
block = []
has_non_comment = False
block.append(line)
if len(line) == 0:
if not is_comment:
for l in block:
f.write(l + "\n")
block = []
is_comment = True
continue
is_comment = line.startswith('#'):
else:
# only blocks with an uncommented line will be output
block = []
is_comment = True

Copy link
Contributor Author

@Teapot4195 Teapot4195 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work if the comment is the last line in the block e.g.:

# some text
some_config=true
# some more text
end of block

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested it. Just tried to reverse the idea of has_non_comment with is_comment and simplify the following block

  if not line.startswith('#'):
      has_non_comment = True

with

is_comment = line.startswith('#'):

to make it easier to read.

Maybe I mischanged something, is it not possible to write it that way?

@onur-ozkan
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2023
@Teapot4195
Copy link
Contributor Author

should have fixed all the issues listed, let me know if i should squash

@onur-ozkan
Copy link
Member

onur-ozkan commented Mar 2, 2023

should have fixed all the issues listed, let me know if i should squash

The code look much better. But it fails the pipeline unfortunately https://github.com/rust-lang/rust/actions/runs/4315278739/jobs/7529435117#step:26:1670

(and yes, please squash the commits at the end)

@Teapot4195
Copy link
Contributor Author

should have fixed all the issues listed, let me know if i should squash

The code look much better. But it fails the pipeline unfortunately https://github.com/rust-lang/rust/actions/runs/4315278739/jobs/7529435117#step:26:1670

(and yes, please squash the commits at the end)

been looking at this, can't tell what is wrong builds just fine on both my win 11 install and on my ubuntu 22.04 install.

@onur-ozkan
Copy link
Member

should have fixed all the issues listed, let me know if i should squash

The code look much better. But it fails the pipeline unfortunately https://github.com/rust-lang/rust/actions/runs/4315278739/jobs/7529435117#step:26:1670
(and yes, please squash the commits at the end)

been looking at this, can't tell what is wrong builds just fine on both my win 11 install and on my ubuntu 22.04 install.

It's not the build thats failing.

python3 x.py test tests/rustdoc-gui --stage 2 --test-args "'--no-sandbox --jobs 1'" this command is failing due to missing /tmp/toolstate/toolstates.json.

You can force push to PR and re-trigger the pipelines to see if the error actually related with your PR. If it does, you might miss something while refactoring(because it pipelines passed before)

@rust-log-analyzer

This comment has been minimized.

@Teapot4195
Copy link
Contributor Author

ah looks like an or turned into an and and it broke everything :)

it's actually fixed now

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@onur-ozkan
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 3, 2023

📌 Commit 00f98e6 has been approved by ozkanonur

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 3, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 4, 2023
…anonur

Omit unchanged options from config.toml in `configure.py`

Leaves section tags, but removes options that are unchanged.
Change in `config.toml.example` is to prevent comments from sneaking in by being directly after a section tag

closes rust-lang#108612
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#108627 (Properly colorize multi-part suggestions in the same line)
 - rust-lang#108632 (Omit unchanged options from config.toml in `configure.py`)
 - rust-lang#108715 (Remove unclosed_delims from parser)
 - rust-lang#108723 (rustdoc: function signature search with traits in `where` clause)
 - rust-lang#108724 (field is not used outside the crate)
 - rust-lang#108734 (rustdoc: Note in a type's layout/size if it is uninhabited)
 - rust-lang#108736 (Remove `allow(potential_query_instability)` from `ast_passes`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 538f19d into rust-lang:master Mar 5, 2023
@rustbot rustbot added this to the 1.69.0 milestone Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Omit commented-out options in configure.py
6 participants