Changeset 6cda7c1 in flex_extract.git for source


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

Location:
source/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/python/_config.py

    rd8785f8 r6cda7c1  
    3131
    3232QUEUES_LIST = ['ecgate', 'cca', 'ccb']
     33
     34INSTALL_TARGETS = ['local', 'ecgate', 'cca']
    3335
    3436# up-to-date available maximum level numbers at ECMWF, 05.10.2018
  • source/python/classes/ControlFile.py

    r2d56c04 r6cda7c1  
    504504        return
    505505
    506     def check_install_conditions(self):
    507         '''Checks a couple of necessary attributes and conditions
    508         for the installation such as if they exist and contain values.
    509         Otherwise set default values.
    510 
    511         Parameters
    512         ----------
    513 
    514         Return
    515         ------
    516 
    517         '''
    518 
    519         if self.install_target and \
    520            self.install_target not in ['local', 'ecgate', 'cca']:
    521             print('ERROR: unknown or missing installation target ')
    522             print('target: ', self.install_target)
    523             print('please specify correct installation target ' +
    524                   '(local | ecgate | cca)')
    525             print('use -h or --help for help')
    526             sys.exit(1)
    527 
    528         if self.install_target and self.install_target != 'local':
    529             if not self.ecgid or not self.ecuid or \
    530                not self.gateway or not self.destination:
    531                 print('Please enter your ECMWF user id and group id as well ' +
    532                       'as the \nname of the local gateway and the ectrans ' +
    533                       'destination ')
    534                 print('with command line options --ecuid --ecgid \
    535                        --gateway --destination')
    536                 print('Try "' + sys.argv[0].split('/')[-1] + \
    537                       ' -h" to print usage information')
    538                 print('Please consult ecaccess documentation or ECMWF user \
    539                        support for further details')
    540                 sys.exit(1)
    541 
    542             if not self.flexpart_root_scripts:
    543                 self.flexpart_root_scripts = '${HOME}'
    544             else:
    545                 self.flexpart_root_scripts = self.flexpart_root_scripts
    546         else: # local
    547             if not self.flexpart_root_scripts:
    548                 self.flexpart_root_scripts = _config.PATH_FLEXEXTRACT_DIR
    549 
    550         return
    551 
    552506    def to_list(self):
    553507        '''Just generates a list of strings containing the attributes and
  • 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