This is an archive of the discontinued LLVM Phabricator instance.

generate_header_tests.py: Sort the header files ASCIIbetically.
ClosedPublic

Authored by Quuxplusone on Dec 11 2020, 11:44 AM.

Details

Summary

Otherwise they come out in random (inode?) order.

Also chmod +x the generator, and re-run it. Somehow on Marek's machine it produced \r\n line endings?! Open all files with newline='\n' so that (if the Python3 docs are correct) that won't happen again.

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Dec 11 2020, 11:44 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptDec 11 2020, 11:44 AM

I thought that it should be git that takes care of line endings... Maybe .gitattributes aren't set correctly, or that was my settings that used CRLF (BTW, I use WSL under Windows so that may be the case).

libcxx/utils/generate_header_tests.py
140

Doesn't that work? Glob returns a list (so an iterable, nope?).

Quuxplusone marked an inline comment as done.
Quuxplusone added inline comments.
libcxx/utils/generate_header_tests.py
140

You're right. Fixed now.
Irrelevant but maybe entertaining backstory: After making my initial patch, I had been getting a weird hang/freeze and (upon Ctrl+C) the error message

^CFailed checking if argv[0] is an import path entry
Traceback (most recent call last):
  File "<frozen zipimport>", line 92, in __init__
KeyError: '/Users/aodwyer/llvm-project/libcxx/utils/generate_header_tests.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 94, in __init__
  File "<frozen zipimport>", line 354, in _read_directory

which I just glanced at, saw it was something about "reading directories" and "zip [iterators?]," and foolishly concluded that the sorted(glob.glob(...)) was the issue. I changed it to sorted(list), the weird error went away, and I posted the diff. But, I see now that that error message was coming from me somehow screwing up my virtualenv; it had absolutely nothing to do with sorted(glob.glob(...)); and its going away right then was completely coincidental.

curdeius accepted this revision.Dec 13 2020, 5:29 AM

LGTM concerning sorting and chmod +x. I believe however that the fix for line endings should be a change in .gitattributes.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 14 2020, 6:57 AM
This revision was automatically updated to reflect the committed changes.