1. SCons
  2. Core
  3. SCons
  4. Pull requests

Pull requests

#101 Declined

More python3-porting - Python 2.7 compatible

  1. Stefan Zimmermann

Hi. I made some further development in the python3-port branch. I was looking for a Python 2/3 compatible SCons port to deploy as a single package at work, to finish the 3.x compatibility migration of our Python stuff. I was happy finding your python3-port, but missed 2.7 compatibility (I just generally try to avoid separate code/packages for 2 and 3). I also encountered some remaining runtime issues and installation problems, so I just tried to solve them, and get some insight into SCons' internals :) Now it runs all of our SCons scripts with Python 2.7 and 3.3. I reverted/modified 2.x incompatible and unnecessary 2to3 changes, added some six.PY2/PY3 based code switches, changed some open() modes, added compile() to exec()s, (re)added future.print_function/.division imports, added missing 3.x compatiblity changes to build/install scripts, and started to make the test scripts Python 3 compatible. Tests are running fine with Python 2.7. I also did some merges with default branch and reverted some stuff I committed before (like print statement changes in test script strings ==> re.sub in TestCmd.write(), or readding list() for key iteration in dict item deletion loops), so this pull request's commit history and diff might be not very nice to follow :( If you are interested in my stuff I could try to recommit it in a cleaner way...

Comments (6)

  1. dirkbaechle

    Hi Stefan,

    and thanks a ton for all the effort you've put into this. We're currently in the middle of releasing the 2.3.1 version, but after that's out of the door Gary will probably have a look at your changes in more detail. He planned to take on the Python3 port again anyway, and your changes will be a great help.

    Best regards,


    1. Gary Oberbrunner

      This is impressive. Lots of great stuff here. The 2.7 + 3.0 single code base is just what we've been trying for. Your changes are already beyond the test fixes I had. However, you're right that the history is a bit tangled. Of course the python3-port branch already doesn't merge cleanly with the current tip, so let's discuss the best strategy for getting this merged in as soon as possible. Perhaps you could merge the current tip into your branch (with fixes as required) and then once I pull it should be easy to merge back into default and close.