Fix a breakage encountered with Mercurial and different Python versions.

Review Request #8806 - Created March 10, 2017 and submitted

Christian Hammond
Review Board
release-2.0.x
7669c1b...
reviewboard
For many years, we've had unit test breakages with the Mercurial unit
tests, and these would sometimes appear random. Some people hit them,
some didn't, and a reinstall often fixed the issue.

The problem turned out to be due to setting PYTHONPATH before executing
hg, causing it to try to load modules potentially compiled under a
different version of Python. In retrospect, this seems pretty obvious.

The reason we set PYTHONPATH originally was so that rbssh would have
access to the correct modules when it runs. However, this wasn't enough
to truly solve the problem, and we ended up fixing this in a different
way (setting/restoring RBSITE_PYTHONPATH) a year after making the change
to set PYTHONPATH. This means that we were unnecessarily setting
PYTHONPATH when calling out to SCMTool-related binaries, breaking
Mercurial.

This change simply removes the PYTHONPATH setting. If PYTHONPATH was set
in the parent process, this will continue to go through to the binary,
but we're no longer setting it explicitly.

Unit tests pass under Python 2.6 and 2.7, including rbssh tests.
Previously, I was hitting the hg issue.

Checked that none of the other binaries we called out to would be
negatively affected by this change, and that rbssh was still ending up
with the right PYTHONPATH.

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/core.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/core.py
    
    
  2. reviewboard/scmtools/core.py (Diff revision 1)
     
     
     'sys' imported but unused
    
  3. 
      
Christian Hammond
David Trowbridge
  1. Ship It!
  2. 
      
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (4735e27)
Loading...