find svn binary location from common install directories
This commit is contained in:
parent
0581963f55
commit
a5572bfc29
1 changed files with 20 additions and 1 deletions
|
@ -32,6 +32,7 @@ except NameError:
|
||||||
|
|
||||||
|
|
||||||
class Subversion(BaseProject):
|
class Subversion(BaseProject):
|
||||||
|
binary_location = None
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
return self._find_project_base(self.path)
|
return self._find_project_base(self.path)
|
||||||
|
@ -44,13 +45,31 @@ class Subversion(BaseProject):
|
||||||
unicode(os.path.basename(self.base))
|
unicode(os.path.basename(self.base))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _find_binary(self):
|
||||||
|
if self.binary_location:
|
||||||
|
return self.binary_location
|
||||||
|
locations = [
|
||||||
|
'svn',
|
||||||
|
'/usr/bin/svn',
|
||||||
|
'/usr/local/bin/svn',
|
||||||
|
]
|
||||||
|
for location in locations:
|
||||||
|
try:
|
||||||
|
Popen([location, '--version'])
|
||||||
|
self.binary_location = location
|
||||||
|
return location
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.binary_location = 'svn'
|
||||||
|
return 'svn'
|
||||||
|
|
||||||
def _get_info(self, path):
|
def _get_info(self, path):
|
||||||
info = OrderedDict()
|
info = OrderedDict()
|
||||||
stdout = None
|
stdout = None
|
||||||
try:
|
try:
|
||||||
os.environ['LANG'] = 'en_US'
|
os.environ['LANG'] = 'en_US'
|
||||||
stdout, stderr = Popen([
|
stdout, stderr = Popen([
|
||||||
'svn', 'info', os.path.realpath(path)
|
self._find_binary(), 'info', os.path.realpath(path)
|
||||||
], stdout=PIPE, stderr=PIPE).communicate()
|
], stdout=PIPE, stderr=PIPE).communicate()
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue