Changeset 6cda7c1 in flex_extract.git for source/python/install.py


Ignore:
Timestamp:
Nov 27, 2018, 11:48:40 PM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
b2e95c3
Parents:
2d56c04
Message:

moved check install coditions to install module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/install.py

    r3946de5 r6cda7c1  
    8080    c = ControlFile(args.controlfile)
    8181    c.assign_args_to_control(args)
    82     c.check_install_conditions()
     82    check_install_conditions(c)
    8383
    8484    install_via_gateway(c)
     
    218218
    219219    return
     220
     221def check_install_conditions(c):
     222    '''Checks a couple of necessary attributes and conditions
     223    for the installation such as if they exist and contain values.
     224    Otherwise set default values.
     225
     226    Parameters
     227    ----------
     228    c : :obj:`ControlFile`
     229        Contains all the parameters of CONTROL file and
     230        command line.
     231
     232
     233    Return
     234    ------
     235
     236    '''
     237
     238    if c.install_target and \
     239       c.install_target not in _config.INSTALL_TARGETS:
     240        print('ERROR: unknown or missing installation target ')
     241        print('target: ', c.install_target)
     242        print('please specify correct installation target ' +
     243              str(INSTALL_TARGETS))
     244        print('use -h or --help for help')
     245        sys.exit(1)
     246
     247    if c.install_target and c.install_target != 'local':
     248        if not c.ecgid or not c.ecuid or \
     249           not c.gateway or not c.destination:
     250            print('Please enter your ECMWF user id and group id as well ' +
     251                  'as the \nname of the local gateway and the ectrans ' +
     252                  'destination ')
     253            print('with command line options --ecuid --ecgid \
     254                   --gateway --destination')
     255            print('Try "' + sys.argv[0].split('/')[-1] + \
     256                  ' -h" to print usage information')
     257            print('Please consult ecaccess documentation or ECMWF user \
     258                   support for further details')
     259            sys.exit(1)
     260
     261        if not c.flexpart_root_scripts:
     262            c.flexpart_root_scripts = '${HOME}'
     263        else:
     264            c.flexpart_root_scripts = c.flexpart_root_scripts
     265    else: # local
     266        if not c.flexpart_root_scripts:
     267            c.flexpart_root_scripts = _config.PATH_FLEXEXTRACT_DIR
     268
     269    return
     270
    220271
    221272def mk_tarball(tarball_path, target):
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG