Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Run 'safe' 2to3 fixers and convert print to PtDebugPrint #119

Merged
merged 2 commits into from May 9, 2020
Merged

Run 'safe' 2to3 fixers and convert print to PtDebugPrint #119

merged 2 commits into from May 9, 2020

Conversation

ghost
Copy link

@ghost ghost commented Mar 15, 2020

Run those 2to3 fixers which should be safe. Additionally, change print calls to PtDebugPrint.

Included fixers: print, exec, import, has_key, repr, funcattrs, raise, except.

Excluded fixers and reasons. Links to commits which apply the fix.

  • unicode: scary string handling changes
  • dict, xrange: changes behaviour (list vs generators) so should only happen when switching to py3. Also generators should be introduced in the py2 code.
  • imports: changes cPickle to pickle which in py2 is a speed difference.
  • long: scary type handling changes
  • metaclass: creates non-py2 code.

The system/ directory is excluded from changes.

ghost referenced this pull request Mar 17, 2020
@Hoikas Hoikas mentioned this pull request May 3, 2020
3 tasks
@Hoikas
Copy link
Member

Hoikas commented May 6, 2020

It looks like there are now conflicts with this PR.

@ghost
Copy link
Author

ghost commented May 6, 2020

Conflixed!

Copy link
Member

@Hoikas Hoikas left a comment

Choose a reason for hiding this comment

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

I think you need to make a pass through and look for any commented out print statements that may be lurking around. I saw a few just glancing at the changes.

Also, there are a few files where it would make more sense to not convert the print() function calls to PtDebugPrint():

  • xEnum.py
    The prints are in a test block that will probably be executed outside of the engine. Hence, PtDebugPrint() is just a stub.
  • plasma/pch.py
    This is designed to be used as console helpers, so we expect the output to be redirected to the console (I hope...). Using PtDebugPrint() sends the output to the log instead.
  • xCheat.py
    This file is used by the Python.Cheat console command and, as above, should output to the console, not the log. Further, xCheat tends to import Plasma instead of from Plasma import *, so the proper call in this file would be plasma.PtDebugPrint() -- not PtDebugPrint().

Python/tldnShroomieBrain.py Outdated Show resolved Hide resolved
Python/xOptionsMenu.py Outdated Show resolved Hide resolved
Python/xOptionsMenu.py Outdated Show resolved Hide resolved
Python/xLinkingBookGUIPopup.py Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented May 7, 2020

I think you need to make a pass through and look for any commented out print statements that may be lurking around. I saw a few just glancing at the changes.

2to3 ignores comments, hence they were skipped (it might affect other fixers as well). I've done a search-replace for the commented prints and amended the commit with those. I also reverted the ones in the three files you mentioned.

@Hoikas Hoikas merged commit 89895a3 into H-uru:master May 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant