bug fix: registerscmtools error print

Review Request #1462 — Created March 7, 2010 and submitted

Information

djs
Review Board

Reviewers

When registerscmtools fails, the errors get lumped together on one line, so call print instead. The dependency on pygments also seems a bit suspect but I didn't look into it.
Ran manage.py registerscmtools

~/reviewboard-dev/reviewboard/reviewboard$ ./manage.py registerscmtools
Unable to load SCMTool svn = reviewboard.scmtools.svn:SVNTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool git = reviewboard.scmtools.git:GitTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool bzr = reviewboard.scmtools.bzr:BZRTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool cvs = reviewboard.scmtools.cvs:CVSTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool perforce = reviewboard.scmtools.perforce:PerforceTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool clearcase = reviewboard.scmtools.clearcase:ClearCaseTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
Unable to load SCMTool hg = reviewboard.scmtools.hg:HgTool: (Pygments 1.0 (/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg), Requirement.parse('Pygments>=1.1.1'))
chipx86
  1. 
      
  2. Could just as easily be done with a \n at the end of the string.
    
    Given the syntax changes coming in Python 2.6, it's probably best to keep sys.stderr.write.
    1. Are you referring to python 3.0 print()? Using a mix of sys.stderr.write and print in the same file is inconsistent and error-prone. 
      
      "It is not recommended to try to write source code that runs unchanged under both Python 2.6 and 3.0; you’d have to use a very contorted coding style, e.g. avoiding print statements, metaclasses, and much more."
      (source: http://docs.python.org/dev/3.0/whatsnew/3.0.html#porting-to-python-3-0)
      
      That said, I suspect I'm going to lose this battle since I greped the code and see you consistently use sys.stderr.write instead... though I did find one interesting case where '\r' is actually used instead of '\n'...
    2. Due to the deafening silence, I suppose I should concede and just use sys.stderr.write ...
  3. 
      
DJ
Review request changed
Change Summary:
concede to sys.stderr.write
mike_conley
  1. This looks fine to me.
    
    Thanks,
    
    -Mike
  2. 
      
chipx86
  1. Looks good. Committed on release-1.0.x as r249bdef. Will be merged to master soon.
  2.