Commit 9bf0241a authored by Julien Muchembled's avatar Julien Muchembled

Cleanup imports

parent 9bb2c613
import errno
from hashlib import md5
import slapos.recipe.downloadunpacked
import imp
import logging
import os
import pkg_resources
from platform import machine as platform_machine
import re
import shutil
import stat
import subprocess
import sys
from hashlib import md5
from platform import machine as platform_machine
import pkg_resources
import zc.buildout
from zc.buildout import UserError
from zc.buildout.buildout import bool_option
from slapos.recipe import downloadunpacked
startup_environ = os.environ.copy()
......@@ -62,7 +63,7 @@ class Recipe(object):
shared = ((options.get('shared', '').lower() == 'true') and
buildout['buildout'].get('shared-part-list', None))
if shared:
self._signature = slapos.recipe.downloadunpacked.Signature(
self._signature = downloadunpacked.Signature(
'.slapos.recipe.cmmi.signature')
buildout_directory = buildout['buildout']['directory']
profile_base_location = options.get('_profile_base_location_', '')
......@@ -105,9 +106,9 @@ class Recipe(object):
options['strip-top-level-dir'] = options.get('strip-top-level-dir', 'false').strip()
if options['url'] and options['path']:
raise zc.buildout.UserError('You must use either "url" or "path", not both!')
raise UserError('You must use either "url" or "path", not both!')
if not (options['url'] or options['path']):
raise zc.buildout.UserError('You must provide either "url" or "path".')
raise UserError('You must provide either "url" or "path".')
if options['url']:
options['compile-directory'] = location + '__compile__'
......@@ -125,7 +126,7 @@ class Recipe(object):
key, value = variable.split('=', 1)
self.environ[key.strip()] = value
except ValueError:
raise zc.buildout.UserError('Invalid environment variable definition: %s' % variable)
raise UserError('Invalid environment variable definition: %s' % variable)
# Add prefix to PATH, CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS
if self.buildout_prefix != '':
self.environ['PATH'] = '%s/bin:%s' % (self.buildout_prefix, self.environ.get('PATH', '/usr/bin'))
......@@ -210,7 +211,7 @@ class Recipe(object):
universal_newlines=True, close_fds=True)
except Exception as e:
self.logger.error(e)
raise zc.buildout.UserError('System error')
raise UserError('System error')
return files.splitlines()
def check_promises(self):
......@@ -250,7 +251,7 @@ class Recipe(object):
env=self.augmented_environment(), close_fds=True)
except Exception as e:
self.logger.error(e)
raise zc.buildout.UserError('System error')
raise UserError('System error')
def install(self):
log = self.logger
......@@ -310,8 +311,7 @@ class Recipe(object):
opt['destination'] = compile_dir
# no need to shared build for compile dir
opt['shared'] = 'false'
slapos.recipe.downloadunpacked.Recipe(
self.buildout, self.name, opt).install()
downloadunpacked.Recipe(self.buildout, self.name, opt).install()
except:
shutil.rmtree(compile_dir)
raise
......@@ -441,7 +441,7 @@ echo %s
self.fix_shebang(location)
if self.options['shared']:
slapos.recipe.downloadunpacked.make_read_only_recursively(location)
downloadunpacked.make_read_only_recursively(location)
return parts
def fix_shebang(self, location):
......
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