forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use libCST to parse imports from python 3 code (pantsbuild#10907)
### Problem Fixes pantsbuild#10894. ### Solution - Add `libcst>=0.3.12,<0.4` to `requirements.txt`. - Remove the usage of the normal python 3 `ast` library from `import_parser.py`, and implement a `_CSTVisitor` to visit import nodes. - When using python 3, instead use the `_CSTVisitor`. - We use python 3.8 to parse all python 3 code, which is 100% correct for the purpose of parsing imports. ### Result We should no longer be dependent on the version of the current python executable to parse python code for dependencies!
- Loading branch information
1 parent
ff02ef0
commit ea542ac
Showing
4 changed files
with
149 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters