use os.devnull for python2 support
This commit is contained in:
parent
c1164d2bd1
commit
138be33349
1 changed files with 8 additions and 7 deletions
|
@ -12,7 +12,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
from subprocess import Popen, PIPE, DEVNULL
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
from .base import BaseProject
|
from .base import BaseProject
|
||||||
try:
|
try:
|
||||||
|
@ -54,12 +54,13 @@ class Subversion(BaseProject):
|
||||||
'/usr/local/bin/svn',
|
'/usr/local/bin/svn',
|
||||||
]
|
]
|
||||||
for location in locations:
|
for location in locations:
|
||||||
try:
|
with open(os.devnull, 'wb') as DEVNULL:
|
||||||
Popen([location, '--version'], stdout=DEVNULL, stderr=DEVNULL)
|
try:
|
||||||
self.binary_location = location
|
Popen([location, '--version'], stdout=DEVNULL, stderr=DEVNULL)
|
||||||
return location
|
self.binary_location = location
|
||||||
except:
|
return location
|
||||||
pass
|
except:
|
||||||
|
pass
|
||||||
self.binary_location = 'svn'
|
self.binary_location = 'svn'
|
||||||
return 'svn'
|
return 'svn'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue