Permalink
Browse files

Fixed some minor coding issues

  • Loading branch information...
1 parent e8db075 commit 023923f0b93f55f010ed5d00374c9b158db66b8d @zerok committed Jun 16, 2009
Showing with 12 additions and 6 deletions.
  1. +12 −6 zerokspot/recipe/git/__init__.py
View
18 zerokspot/recipe/git/__init__.py
@@ -21,15 +21,17 @@
import os.path
import zc.buildout
import shutil
-from pdb import set_trace
+
def git(operation, args, message):
command = r'git %s ' + ' '.join(('"%s"',) * len(args))
command = command % ((operation,) + tuple(args))
- status = subprocess.call(command, shell=True)
+ status = subprocess.call(command, shell=True, stdout=open(os.devnull, 'w'),
+ stderr=subprocess.STDOUT)
if status != 0:
raise zc.buildout.UserError(message)
+
def get_reponame(url, branch = None, rev = None):
"""
Given the URL of a repository, this function returns the name of it after
@@ -97,20 +99,23 @@ def install(self):
# the download cache, fetch the repo as usual and then copy it
# into the download cache.
if os.path.exists(self.cache_path):
- git('clone', (self.cache_path, self.options['location']), 'Failed to clone repository')
+ git('clone', (self.cache_path, self.options['location']),
+ 'Failed to clone repository')
os.chdir(self.buildout['buildout']['directory'])
self.installed_from_cache = True
return self.options['location']
else:
- raise zc.buildout.UserError("No repository in the download cache directory.")
+ raise zc.buildout.UserError("No repository in the download "
+ "cache directory.")
else:
os.chdir(self.buildout['buildout']['download-cache'])
if os.path.exists(self.cache_path):
shutil.rmtree(self.cache_path)
- git('clone', (self.repository, self.cache_name), 'Failed to clone repository')
+ git('clone', (self.repository, self.cache_name),
+ 'Failed to clone repository')
os.chdir(self.cache_path)
if self.branch != 'master':
@@ -123,7 +128,8 @@ def install(self):
if self.rev is not None:
git('checkout', (self.rev,), 'Failed to checkout revision')
- git('clone', (self.cache_path, self.options['location']), 'Failed to clone repository')
+ git('clone', (self.cache_path, self.options['location']),
+ 'Failed to clone repository')
if self.as_egg:
self._install_as_egg()

0 comments on commit 023923f

Please sign in to comment.