From 318e84f34154b91673264ddd3f573c72b6b78f48 Mon Sep 17 00:00:00 2001 From: Jose Idar Date: Mon, 9 Dec 2013 22:03:32 -0600 Subject: [PATCH] Changes setup.py to use cafe config installer Change-Id: Ia34019e86c6831e8abf1d1c833a552bae2b8642b --- setup.py | 47 ++--------------------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/setup.py b/setup.py index 8d79a40f..a40e2680 100644 --- a/setup.py +++ b/setup.py @@ -16,8 +16,6 @@ limitations under the License. import os import sys -import shutil -import textwrap try: @@ -52,51 +50,10 @@ def print_cafe_mug(): print("========================================================") -def install_default_configs(): - from cafe.configurator.managers import ( - EngineDirectoryManager, PlatformManager) - - opencafe_root_dir = EngineDirectoryManager.OPENCAFE_ROOT_DIR - - twrap = textwrap.TextWrapper( - initial_indent='* ', subsequent_indent=' ', break_long_words=False) - print twrap.fill( - 'Installing reference configuration files in ...'.format( - opencafe_root_dir)) - - twrap = textwrap.TextWrapper( - initial_indent=' ', subsequent_indent=' ', break_long_words=False) - - _printed = [] - for root, subFolders, files in os.walk('configs'): - for file_ in files: - source = os.path.join(root, file_) - destination_dir = os.path.join(opencafe_root_dir, root) - destination_file = os.path.join(destination_dir, file_) - - try: - #Create the expected directory structure if it doesn't already - #exist. - os.makedirs(destination_dir) - print twrap.fill('Creating path: {0}'.format(destination_dir)) - except OSError: - #File exsits. This is ok and expected. - pass - - shutil.copyfile(source, destination_file) - if destination_dir not in _printed: - print twrap.fill('{0}'.format(destination_dir)) - _printed.append(destination_dir) - - if not PlatformManager.USING_WINDOWS: - uid = PlatformManager.get_user_uid() - gid = PlatformManager.get_user_gid() - os.chown(destination_file, uid, gid) - - #Post-install engine configuration def _post_install(dir): - install_default_configs() + from cafe.configurator.managers import EngineConfigManager + EngineConfigManager.install_optional_configs('configs') print_cafe_mug()