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

"Modernize" to Python 3.6 via tool #4390

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Conversation

mwichmann
Copy link
Collaborator

$ pyupgrade --py36-plus $(<filelist)

Here's mostly what it's done:

  • No more 'stringliteral'.encode('utf-8'): now b'stringliteral'
  • No more unicode literals
  • the default open mode is 'r', leaves out if default
  • some f-string conversions (if shorter)
  • catch OSError instead of subclasses
  • no more mention of object
  • generator expression instead of list comp. when safe
  • a few tests had a shebang, but actually began with blank line
  • remove coding: utf-8 comment, per pep 3120 this is the default now

Manually - if a file in test/ was modified, then did the copyright header conversion.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

$ pyupgrade --py36-plus $(<filelist)

Here's mostly what it's done:

- No more 'stringliteral'.encode('utf-8'): now b'stringliteral'
- No more unicode literals
- the default open mode is 'r', leaves out if default
- some f-string conversions (if shorter)
- catch OSError instead of subclasses
- no more mention of "object"
- generator expression instead of list comp. when safe
- a few tests had a shebang but actually began with blank line
- remove coding: utf-8  comment, per pep 3120 this is the default now

Manually - if a file in test/ was modified, then did the copyright
header conversion.

Signed-off-by: Mats Wichmann <mats@linux.com>
@mwichmann mwichmann added the maintenance Tasks to maintain internal SCons code/tools label Aug 4, 2023
@mwichmann
Copy link
Collaborator Author

The objective here is to not have to deal with these manually...

mwichmann and others added 2 commits August 4, 2023 09:11
Some of these got done in the tool conversion, some not,
so picked up the rest manually.

Signed-off-by: Mats Wichmann <mats@linux.com>
@bdbaddog bdbaddog merged commit ef0cb9f into SCons:master Aug 24, 2023
6 of 7 checks passed
@mwichmann mwichmann added this to the NextRelease milestone Aug 24, 2023
@mwichmann mwichmann deleted the maint/modernize branch August 24, 2023 18:44
@jcbrill
Copy link
Contributor

jcbrill commented Aug 27, 2023

@mwichmann Is it possible to share the filelist that was used in the pyupgrade command: $(<filelist)?

I have a handful of local branches that are not quite ready to be submitted yet. These "global" changes that modify a bunch of files are sometimes difficult (for me at least) to merge with the latest master.

Running the pyupgrade script against the same file list would be a huge time saver.

Any suggestions are welcome.

@mwichmann
Copy link
Collaborator Author

Yes, sorry about that, they're a pain to deal with (me too, I have too many patchsets in flight). I don't think this is the one I used, but I've used this one for other checkers (renamed due to github restrictions)

filelist.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Tasks to maintain internal SCons code/tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants