Re: [chromium-dev] Re: New Presubmit actions

2009-11-18 Thread Jói Sigurðsson
I use a script like the following to fix trailing whitespace when I
get errors (I pipe the output of gcl presubmit to it).  You can easily
extend it to fix bad line-endings (it will already ensure all touched
files use \n) and it should be straightforward to extend it to do the
propset stuff as well.

Cheers,
Jói


import re
import sys

output = sys.stdin.read()
filenames = []

# First find trailing whitespace concerns as per Chrome's presubmit.
rex = re.compile(
r'.+Found line ending with white spaces in[^*]+\*+\s+([^*]+)\*+.*',
re.M | re.S)
result = rex.match(output)
if result:
  block = result.group(1)
  filenames.extend(re.findall('(.+?), line [0-9]+', block))

if not filenames:
  print Found no problem files

done_processing = {}
for filename in filenames:
  if filename in done_processing:
print Already processed %s % filename
continue
  done_processing[filename] = 1

  f = open(filename, 'rb')
  lines = f.readlines()
  f.close()

  f = open(filename, 'wb')
  for line in lines:
line = line.rstrip()
f.write(line)
f.write('\n')
  f.close()
  print Finished processing %s % filename


On Wed, Nov 18, 2009 at 4:32 PM, Marc-Antoine Ruel mar...@chromium.org wrote:
 First, I'd prefer to keep the presubmit checks from having any side-effect.

 For a)
 You haven't mentioned which editor you use but if it is a problem for
 you, maybe you should tweak the editor? VS, emacs, vim can be modified
 to do it or at least highlight it; I don't know about xcode. Otherwise
 a very simple python script can do it for you, maybe you could create
 a new kind of gcl hook. git already has functionality for commit
 hooks.

 For b), follow the steps at
 http://dev.chromium.org/developers/coding-style#TOC-Subversion-properties
 It's necessary for git usage too.

 M-A

 On Wed, Nov 18, 2009 at 4:26 PM, Dave MacLachlan dmacl...@google.com wrote:
 Hey Marc-Antoine:

 What would it take to have the presubmit scripts automagically do the
 following:

 a) Remove all whitespace at the end of .h, .c, .cc and .mm files?
 b) Apply 'svn pset svn:eol-style LF' as necessary to .h, .c, .cc and .mm
 files?

 This would save me a great deal of time. My editor of choice does not take
 care of getting rid of the whitespace for me.

 Cheers,
 Dave


 --
 Chromium Developers mailing list: chromium-dev@googlegroups.com
 View archives, change email options, or unsubscribe:
    http://groups.google.com/group/chromium-dev


-- 
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev


[chromium-dev] Re: Build problems on Windows: native client missing headers

2009-10-01 Thread Jói Sigurðsson

This has been fixed (not by me), the NaCl build files will now find
Python from third_party.

I have a pending change to fix the same issue in chrome_frame/chrome_frame.gyp.

Cheers,
Jói


On Thu, Oct 1, 2009 at 1:46 AM, Roland Steiner rolandstei...@google.com wrote:
 FWIW, I had similar troubles with NaCl auto-generated headers, but in my
 case the underlying problem was VS not finding Python. Adding the
 depot_tools path to the Windows system path fixed this problem for me.
 - Roland

 On Thu, Oct 1, 2009 at 6:43 AM, Jay Campan jcam...@chromium.org wrote:

 If you get build errors on Windows about some native client generated
 header file missing, make sure to run the sync command from cmd.exe,
 not from cygwin bash.
 (or just run gclient runhook --force from cmd.exe)

 There is a bug
 (http://code.google.com/p/nativeclient/issues/detail?id=105)
 when generating the vcproj from cygwin's bash.

 Jay




 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---