use os.devnull for python2 support

This commit is contained in:
Alan Hamlett 2014-08-29 12:46:28 -07:00
parent 1509519438
commit a2f1436477
1 changed files with 8 additions and 7 deletions

View File

@ -12,7 +12,7 @@
import logging
import os
import platform
from subprocess import Popen, PIPE, DEVNULL
from subprocess import Popen, PIPE
from .base import BaseProject
try:
@ -54,12 +54,13 @@ class Subversion(BaseProject):
'/usr/local/bin/svn',
]
for location in locations:
try:
Popen([location, '--version'], stdout=DEVNULL, stderr=DEVNULL)
self.binary_location = location
return location
except:
pass
with open(os.devnull, 'wb') as DEVNULL:
try:
Popen([location, '--version'], stdout=DEVNULL, stderr=DEVNULL)
self.binary_location = location
return location
except:
pass
self.binary_location = 'svn'
return 'svn'