-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Use the improved submodule handling #42081
Conversation
Just a quick feedback on that: |
If possible, can you also check for any Python 2 incompatibilities? |
r? @aidanhs Mind taking a look at this? I think you know more about submodules than I |
@ishitatsuyuki The Python 2/3 thing is the same as #42085? (fixed in #42089) |
914f6da
to
97e7f9c
Compare
I have rebased the things. This should supersede #42089, if it was possible to gain approval. ... sorry for the redundant formatting, I couldn't keep up without my auto formatter. |
src/bootstrap/bootstrap.py
Outdated
# submodule path | ||
submodules = [s.split()[1] for s in subprocess.check_output( | ||
["git", "config", "--file", os.path.join( | ||
self.rust_root, ".gitmodules"), "--get-regexp", "path"]).splitlines()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we probably do actually need to do the defaultencoding dance even here, doesn't windows sometimes use two-byte unicode encodings? Which would mean checking for b"llvm"
wouldn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The command line uses the current code page, which IIRC is ASCII compat. Minding trying out that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are indeed correct.
That said, I feel like being consistent with the rest of the file (which uses defaultencoding) is probably worthwhile. Indeed, two reviewers of this PR have already been confused by imagined possible problems!
☔ The latest upstream changes (presumably #42105) made this pull request unmergeable. Please resolve the merge conflicts. |
b153b03
to
8f111f3
Compare
Rebase made with the |
src/bootstrap/bootstrap.py
Outdated
submodules = [module for module in submodules | ||
if not ((module.endswith(b"llvm") and | ||
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or | ||
(module.endswith(b"jemalloc") and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fairly certain that using b"..."
will break Python 3 compatibility, see #42089.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... what if I tell you that I happily ran it on my Arch laptop which has Py3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, odd. Not sure why it was changed in that PR then. Never mind me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the original PR decoded the pipe output which is in system default encoding, and can vary on Windows. However, I'm quite sure that all code pages are ASCII compat, which doesn't pose a problem if you're dealing with pure English paths. (want some emoji there? :P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original PR took didn't decode at all, which was the problem - it took a bytestring of submodules and tried split it with a string, which isn't allowed. The followup PR made sure the bytestring was converted to a string like all the other outputs from commands in the file, so now using bytestrings would be incorrect. This PR goes back to not decoding command output, so bytestrings are correct again.
Tested on Centos 6, r=me after moving from bytestrings to defaultencoding for consistency (if you happen to undo the autoformat diff noise at the same time then that'd also be fantastic). |
@aidanhs I'm not sure if |
My logic is simply that it's ideal if this file is consistent. Since the rest of the file uses |
Roughly tested on both Arch and CentOS 6. |
Great! Thanks very much for bearing with me @ishitatsuyuki :) @bors r+ |
📌 Commit d34aaa1 has been approved by |
…idanhs Use the improved submodule handling r? @alexcrichton That was a crap... ``` Updating submodules Traceback (most recent call last): File "./x.py", line 20, in <module> bootstrap.main() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 684, in main bootstrap() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 662, in bootstrap rb.update_submodules() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 566, in update_submodules path = line[1:].split(' ')[1] TypeError: a bytes-like object is required, not 'str' ``` Maybe we need to confirm the compatibility of git options, such as `git config` or `git -C` (I believe they existed long before, though). This is tested locally.
…idanhs Use the improved submodule handling r? @alexcrichton That was a crap... ``` Updating submodules Traceback (most recent call last): File "./x.py", line 20, in <module> bootstrap.main() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 684, in main bootstrap() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 662, in bootstrap rb.update_submodules() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 566, in update_submodules path = line[1:].split(' ')[1] TypeError: a bytes-like object is required, not 'str' ``` Maybe we need to confirm the compatibility of git options, such as `git config` or `git -C` (I believe they existed long before, though). This is tested locally.
☔ The latest upstream changes (presumably #42212) made this pull request unmergeable. Please resolve the merge conflicts. |
Also, improve the split mechanism to address space in paths.
d34aaa1
to
15c26c9
Compare
Rebased. Didn't tested on CentOS yet, but I believe it should be fine. Works fine on Arch with both Python 2/3. |
Review please. Basically I think this is tested and reviewed enough and it's fine to r+ as I only did a rebase. |
@bors r+ |
📌 Commit 15c26c9 has been approved by |
⌛ Testing commit 15c26c9 with merge 5579677... |
Use the improved submodule handling r? @alexcrichton That was a crap... ``` Updating submodules Traceback (most recent call last): File "./x.py", line 20, in <module> bootstrap.main() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 684, in main bootstrap() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 662, in bootstrap rb.update_submodules() File "/home/ishitatsuyuki/Documents/rust/src/bootstrap/bootstrap.py", line 566, in update_submodules path = line[1:].split(' ')[1] TypeError: a bytes-like object is required, not 'str' ``` Maybe we need to confirm the compatibility of git options, such as `git config` or `git -C` (I believe they existed long before, though). This is tested locally.
☀️ Test successful - status-appveyor, status-travis |
r? @alexcrichton
That was a crap...
Maybe we need to confirm the compatibility of git options, such as
git config
orgit -C
(I believe they existed long before, though). This is tested locally.