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

code cleanup.

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