Commit 7dae0407 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

code cleanup.

parent 1b313999
......@@ -24,7 +24,7 @@ setup(name=name,
include_package_data=True,
install_requires=[
'setuptools', # namespaces
'zc.buildout', # plays with buildout
'zc.buildout<2.0.0', # plays with buildout
'slapos.libnetworkcache>=0.13.1', # Uses helper new in this version
],
extras_require={
......
......@@ -181,8 +181,8 @@ class Script:
else:
raise zc.buildout.UserError('Unknown promise %r' % promise)
if len(promise_problem_list):
raise zc.buildout.UserError('Promise not met, found issues:\n %s' %
' '.join([q + '\n' for q in promise_problem_list]))
raise zc.buildout.UserError('Promise not met, found issues:\n %s\n' %
'\n '.join(promise_problem_list))
def download(self, url, md5sum=None):
download = zc.buildout.download.Download(self.buildout['buildout'],
......@@ -309,7 +309,6 @@ class Script:
def install(self):
try:
env = self.getEnvironment()
if os.path.exists(self.options['location']):
self.cleanup_dir_list.append(self.options['location'])
raise shutil.Error('Directory %s already exists' %
......@@ -343,7 +342,6 @@ class Script:
if self.update_script is None:
return None
try:
env = self.getEnvironment()
exec self.options['update_script']
try:
self._checkPromise('slapos_update_promise', self.options['location'])
......
......@@ -8,6 +8,8 @@ import stat
import tempfile
import unittest
import zc.buildout.testing
from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
GIT_CLONE_CACHE_ERROR_MESSAGE
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
......@@ -60,8 +62,6 @@ class GitCloneNonInformativeTests(unittest.TestCase):
return Recipe(bo, 'test', default_options)
def test_using_download_cache_if_git_fails(self):
from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
GIT_CLONE_CACHE_ERROR_MESSAGE
recipe = self.makeGitCloneRecipe({"use-cache": "true",
"repository": BAD_GIT_REPOSITORY})
os.chdir(self.dir)
......@@ -73,8 +73,6 @@ class GitCloneNonInformativeTests(unittest.TestCase):
self.assertEquals(e.message, GIT_CLONE_CACHE_ERROR_MESSAGE)
def test_not_using_download_cache_if_forbidden(self):
from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
GIT_CLONE_ERROR_MESSAGE
recipe = self.makeGitCloneRecipe({"repository": BAD_GIT_REPOSITORY})
os.chdir(self.dir)
try:
......@@ -99,8 +97,6 @@ class GitCloneNonInformativeTests(unittest.TestCase):
self.assertFalse(os.path.exists(bad_file_path), "pyc file not removed")
def test_ignore_ssl_certificate(self, ignore_ssl_certificate=True):
from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
GIT_CLONE_CACHE_ERROR_MESSAGE
import slapos.recipe.gitclone
# Monkey patch check_call
......
......@@ -25,6 +25,7 @@
#
##############################################################################
import errno
import hashlib
import os
import shutil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment