#NEWLINE# def setup( i ) : #NEWLINE# #INDENT# "\n\n    Input:  {\n              (group)      - if !='', configure only this group:\n                             * recache - recache repos (needed during first run for remote repos)\n                             * install - install as python library\n                             * update - check for update\n                             * content - related to content \n                             * repos - related to repositories \n                             * git - related to git repos\n                             * editing - related to editing\n                             * writing - related to writing control \n                             * wfe - related to web front end\n                             * indexing - related to indexing\n            }\n\n    Output: {\n              return       - return code =  0, if successful\n                                         >  0, if error\n              (error)      - error text if return > 0\n            }\n\n    " #NEWLINE# r = ck . get_os_ck ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( r [ 'return' ] > 0 ) : #NEWLINE# #INDENT# return r #NEWLINE# #UNINDENT# plat = r [ 'platform' ] #NEWLINE# param = i . get ( 'param' , '' ) #NEWLINE# if ( param == '' ) : #NEWLINE# #INDENT# if ( i . get ( 'content' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'content' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'install' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'install' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'update' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'update' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'editing' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'editing' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'git' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'git' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'repos' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'repos' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'writing' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'writing' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'wfe' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'wfe' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i . get ( 'indexing' , '' ) == 'yes' ) : #NEWLINE# #INDENT# param = 'indexing' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# xcfg = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# ck . out ( sep ) #NEWLINE# ck . out ( 'Loading current configuration ...' ) #NEWLINE# r = ck . access ( { #NEWLINE# #INDENT# 'action' : 'load' , #NEWLINE# 'repo_uoa' : ck . cfg [ 'repo_name_default' ] , #NEWLINE# 'module_uoa' : ck . cfg [ 'subdir_kernel' ] , #NEWLINE# 'data_uoa' : ck . cfg [ 'subdir_kernel_default' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( r [ 'return' ] == 0 ) : #NEWLINE# #INDENT# xcfg . update ( r [ 'dict' ] ) #NEWLINE# #UNINDENT# r = ck . access ( { #NEWLINE# #INDENT# 'action' : 'load' , #NEWLINE# 'repo_uoa' : ck . cfg [ 'repo_name_local' ] , #NEWLINE# 'module_uoa' : ck . cfg [ 'subdir_kernel' ] , #NEWLINE# 'data_uoa' : ck . cfg [ 'subdir_kernel_default' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( r [ 'return' ] == 0 ) : #NEWLINE# #INDENT# xcfg . update ( r [ 'dict' ] ) #NEWLINE# #UNINDENT# if ( ( param == '' ) or ( param == 'recache' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Caching all repos (to speed up search) ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Would you like to (re)cache all repos (y/N): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = '' #NEWLINE# x = r [ 'string' ] . lower ( ) #NEWLINE# if ( ( x == 'y' ) or ( x == 'yes' ) ) : #NEWLINE# #INDENT# ck . out ( '' ) #NEWLINE# r = ck . access ( { #NEWLINE# #INDENT# 'action' : 'recache' , #NEWLINE# 'module_uoa' : cfg [ 'module_deps' ] [ 'repo' ] , #NEWLINE# 'out' : 'con' , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( r [ 'return' ] > 0 ) : #NEWLINE# #INDENT# return r #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'install' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Installation of CK as python library ***' ) #NEWLINE# installed = True #NEWLINE# try : #NEWLINE# #INDENT# import ck.kernel as ckx #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# installed = False #NEWLINE# #UNINDENT# if ( ( param == 'install' ) or ( ( param == '' ) and ( not installed ) and ( xcfg . get ( 'skip_ck_install' , '' ) != 'yes' ) ) ) : #NEWLINE# #INDENT# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Would you like to install CK as root library (y/N): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = '' #NEWLINE# x = r [ 'string' ] . lower ( ) #NEWLINE# if ( ( x == 'y' ) or ( x == 'yes' ) ) : #NEWLINE# #INDENT# d = 'yes' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# r1 = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Do not ask this question again (Y/n): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d1 = '' #NEWLINE# x1 = r1 [ 'string' ] . lower ( ) #NEWLINE# if ( ( x1 == 'y' ) or ( x1 == 'yes' ) ) : #NEWLINE# #INDENT# xcfg [ 'skip_ck_install' ] = 'yes' #NEWLINE# #UNINDENT# #UNINDENT# if ( d == 'yes' ) : #NEWLINE# #INDENT# p = ck . work [ 'env_root' ] #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( ( '* Changing directory to ' + p ) + ' ...' ) ) #NEWLINE# os . chdir ( p ) #NEWLINE# c = ck . cfg [ 'install_ck_as_lib' ] #NEWLINE# r = ck . get_os_ck ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( r [ 'return' ] > 0 ) : #NEWLINE# #INDENT# return r #NEWLINE# #UNINDENT# plat = r [ 'platform' ] #NEWLINE# if ( plat != 'win' ) : #NEWLINE# #INDENT# c = ( ( ck . cfg . get ( 'linux_sudo' , '' ) + ' ' ) + c ) #NEWLINE# #UNINDENT# ck . out ( '' ) #NEWLINE# ck . out ( ( ( '* Executing command "' + c ) + '" ...' ) ) #NEWLINE# os . system ( c ) #NEWLINE# #UNINDENT# #UNINDENT# installed = True #NEWLINE# try : #NEWLINE# #INDENT# import ck.kernel as ckx #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# installed = False #NEWLINE# #UNINDENT# if installed : #NEWLINE# #INDENT# ck . out ( '' ) #NEWLINE# ck . out ( 'CK is now installed as python library. Testing ...' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ckx . test ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ck . out ( '' ) #NEWLINE# ck . out ( 'CK was not installed as Python library.' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'update' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Check latest version ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Would you like to check if your version is up-to-date (Y/n): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# x = r [ 'string' ] . lower ( ) #NEWLINE# if ( ( x != 'n' ) and ( x != 'no' ) ) : #NEWLINE# #INDENT# ck . out ( '' ) #NEWLINE# ck . status ( { #NEWLINE# #INDENT# 'out' : 'con' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'content' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Content authorship ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( 'Current author/developer of the content: ' + xcfg . get ( 'default_developer' , ck . cfg . get ( 'default_developer' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Current author/developer email :         ' + xcfg . get ( 'default_developer_email' , ck . cfg . get ( 'default_developer_email' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Current author/developer webpage :       ' + xcfg . get ( 'default_developer_webpage' , ck . cfg . get ( 'default_developer_webpage' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Current copyright of the content:        ' + xcfg . get ( 'default_copyright' , ck . cfg . get ( 'default_copyright' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Current license of the content:          ' + xcfg . get ( 'default_license' , ck . cfg . get ( 'default_license' , '' ) ) ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change author/developer of the content (or Enter to keep previous): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_developer' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change author/developer email (or Enter to keep previous):          ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_developer_email' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change author/developer webpage (or Enter to keep previous):        ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_developer_webpage' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change copyright of the content (or Enter to keep previous):        ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_copyright' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change license of the content (or Enter to keep previous):          ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_license' ] = d #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'repos' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Repositories control ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# x = xcfg . get ( 'default_shared_repo_url' , '' ) #NEWLINE# if ( x == '' ) : #NEWLINE# #INDENT# x = ck . cfg . get ( 'default_shared_repo_url' , '' ) #NEWLINE# #UNINDENT# ck . out ( ( 'Default URL for shared repositories: ' + x ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Enter new URL (Enter to keep current): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# x = r [ 'string' ] #NEWLINE# if ( xcfg != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_shared_repo_url' ] = x #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'editing' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Editing control ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( 'CMD to edit meta-description of entries: ' + xcfg . get ( 'external_editor' , ck . cfg . get ( 'external_editor' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) . get ( plat , '' ) ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Enter CMD to enter meta-description using $#filename#$ to substitute filename (Enter to keep previous): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# if ( 'external_editor' not in xcfg ) : #NEWLINE# #INDENT# xcfg [ 'external_editor' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# xcfg [ 'external_editor' ] [ plat ] = d #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'git' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Set up GIT repos ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( 'Current URL of default GIT repo with user : ' + xcfg . get ( 'default_shared_repo_url' , ck . cfg . get ( 'default_shared_repo_url' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Current URL of default GIT repo :           ' + xcfg . get ( 'github_repo_url' , ck . cfg . get ( 'github_repo_url' , '' ) ) ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change URL of default GIT repo with user (or Enter to keep previous): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'default_shared_repo_url' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Change URL of default GIT repo (or Enter to keep previous):           ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] #NEWLINE# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'github_repo_url' ] = d #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'writing' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Writing control ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( 'Forbid all writing operations (useful for permanent web-based repositories):     ' + xcfg . get ( 'forbid_global_writing' , ck . cfg . get ( 'forbid_global_writing' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Forbid delete/rename operations (useful for aggregating web-based repositories): ' + xcfg . get ( 'forbid_global_delete' , ck . cfg . get ( 'forbid_global_delete' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Forbid writing modules (adding/updating/removing):                               ' + xcfg . get ( 'forbid_writing_modules' , ck . cfg . get ( 'forbid_writing_modules' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Forbid writing to default repo:                                                  ' + xcfg . get ( 'forbid_writing_to_default_repo' , ck . cfg . get ( 'forbid_writing_to_default_repo' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Forbid writing to local repo:                                                    ' + xcfg . get ( 'forbid_writing_to_local_repo' , ck . cfg . get ( 'forbid_writing_to_local_repo' , '' ) ) ) ) #NEWLINE# ck . out ( ( 'Allow writing only to allowed individual repos:                                  ' + xcfg . get ( 'allow_writing_only_to_allowed' , ck . cfg . get ( 'allow_writing_only_to_allowed' , '' ) ) ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Forbid all writing operations (yes or Enter to keep previous)?:                  ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'forbid_global_writing' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Forbid all delete operations (yes or Enter to keep previous)?:                   ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'forbid_global_delete' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Forbid adding new modules (yes or Enter to keep previous)?:                      ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'forbid_writing_modules' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Forbid writing to default repo (yes or Enter to keep previous)?:                 ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'forbid_writing_to_default_repo' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Forbid writing to local repo (yes or Enter to keep previous)?:                   ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'forbid_writing_to_local_repo' ] = d #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Allow writing only to allowed individual repos (yes or Enter to keep previous)?: ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'allow_writing_only_to_allowed' ] = d #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'wfe' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Web front end control (through CK web server or third-party web server and CK php connector) ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# x = xcfg . get ( 'wfe_url_prefix' , '' ) #NEWLINE# if ( x == '' ) : #NEWLINE# #INDENT# x = ck . cfg . get ( 'wfe_url_prefix' , '' ) #NEWLINE# #UNINDENT# ck . out ( ( 'Current web front-end URL prefix: ' + x ) ) #NEWLINE# x = xcfg . get ( 'wfe_template' , '' ) #NEWLINE# if ( x == '' ) : #NEWLINE# #INDENT# x = ck . cfg . get ( 'wfe_template' , '' ) #NEWLINE# #UNINDENT# ck . out ( ( 'Current web front-end template:   ' + x ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Enter new web front-end URL prefix (Enter to keep previous): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# x = r [ 'string' ] #NEWLINE# if ( x != '' ) : #NEWLINE# #INDENT# xcfg [ 'wfe_url_prefix' ] = x #NEWLINE# #UNINDENT# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Enter new web front-end template (Enter to keep previous): ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# x = r [ 'string' ] #NEWLINE# if ( x != '' ) : #NEWLINE# #INDENT# xcfg [ 'wfe_template' ] = x #NEWLINE# #UNINDENT# #UNINDENT# if ( ( param == '' ) or ( param == 'indexing' ) ) : #NEWLINE# #INDENT# ck . out ( sep ) #NEWLINE# ck . out ( '*** Indexing control (through ElasticSearch) ***' ) #NEWLINE# ck . out ( '' ) #NEWLINE# ck . out ( ( 'Use indexing: ' + xcfg . get ( 'use_indexing' , ck . cfg . get ( 'use_indexing' , '' ) ) ) ) #NEWLINE# ck . out ( '' ) #NEWLINE# r = ck . inp ( { #NEWLINE# #INDENT# 'text' : 'Use indexing (yes or Enter to keep previous)?: ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d = r [ 'string' ] . lower ( ) #NEWLINE# if ( d == 'y' ) : #NEWLINE# #INDENT# ( d == 'yes' ) #NEWLINE# #UNINDENT# if ( d != '' ) : #NEWLINE# #INDENT# xcfg [ 'use_indexing' ] = d #NEWLINE# #UNINDENT# #UNINDENT# ck . out ( sep ) #NEWLINE# fc = ck . work [ 'dir_work_cfg' ] #NEWLINE# if os . path . isfile ( fc ) : #NEWLINE# #INDENT# ck . out ( 'Writing local configuration (directly) ...' ) #NEWLINE# r = ck . save_json_to_file ( { #NEWLINE# #INDENT# 'json_file' : fc , #NEWLINE# 'dict' : xcfg , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ck . out ( 'Adding local configuration ...' ) #NEWLINE# ii = { #NEWLINE# #INDENT# 'action' : 'update' , #NEWLINE# 'repo_uoa' : ck . cfg [ 'repo_name_local' ] , #NEWLINE# 'module_uoa' : work [ 'self_module_uoa' ] , #NEWLINE# 'data_uoa' : ck . cfg [ 'subdir_kernel_default' ] , #NEWLINE# 'dict' : xcfg , #NEWLINE# 'substitute' : 'yes' , #NEWLINE# 'ignore_update' : 'yes' , #NEWLINE# #UNINDENT# } #NEWLINE# r = ck . access ( ii ) #NEWLINE# #UNINDENT# if ( r [ 'return' ] > 0 ) : #NEWLINE# #INDENT# return r #NEWLINE# #UNINDENT# ck . out ( '' ) #NEWLINE# ck . out ( ( ( 'Configuration successfully recorded to ' + fc ) + ' ...' ) ) #NEWLINE# return { #NEWLINE# #INDENT# 'return' : 0 , #NEWLINE# #UNINDENT# }