コード例 #1
0
ファイル: installer.py プロジェクト: TeeJayYang/dotinstall
 def install(self, dependency):
     if self._is_installed(dependency):
         Logger.info("'{}' is already installed.\n".format(dependency, ))
     elif self._install(dependency):
         Logger.success("'{}' has been successfully installed.\n".format(
             dependency, ))
     else:
         Logger.error("'{}' could not be installed.\n".format(dependency, ))
コード例 #2
0
def parse_data(package, package_name):
    ret = {
        'linkLocations': [],
        'overwrite': True,
        'clean': True,
        'prelink': [],
        'postlink': [],
        'dependencies': [],
        'symlinkedFiles': set(),
        'package': package_name,
    }

    if 'link' not in package:
        Logger.error('No link attribute set.\n')
        exit(1)
    elif isinstance(package['link'], list):
        ret['linkLocations'] = package['link']
    else:
        ret['linkLocations'] = [
            {
                '*': package['link']
            },
            {
                '.*': package['link']
            },
        ]

    if 'overwrite' in package:
        ret['overwrite'] = package['overwrite']

    if 'prelink' in package:
        ret['prelink'] = package['prelink']

    if 'postlink' in package:
        ret['postlink'] = package['postlink']

    if 'dependencies' in package:
        ret['dependencies'] = package['dependencies']

    if 'clean' in package:
        ret['clean'] = package['clean']

    return ret
コード例 #3
0
def test_error(mock_log):
    Logger.error('message')
    mock_log.assert_called_once_with(Level.ERROR, 'message')