コード例 #1
0
ファイル: test_pkg_info.py プロジェクト: pvk84/naclports
 def testValidKeys(self):
     expected_error = "Invalid key 'BAR' in info file dummy_file:2"
     contents = 'FOO=bar\nBAR=baz\n'
     valid = ['FOO']
     required = []
     with self.assertRaisesRegexp(error.Error, expected_error):
         pkg_info.ParsePkgInfo(contents, 'dummy_file', valid, required)
コード例 #2
0
ファイル: test_pkg_info.py プロジェクト: pvk84/naclports
 def testRequiredKeys(self):
     expected_error = "Required key 'BAR' missing from info file: 'dummy_file'"
     contents = 'FOO=bar\n'
     valid = ['FOO']
     required = ['BAR']
     with self.assertRaisesRegexp(error.Error, expected_error):
         pkg_info.ParsePkgInfo(contents, 'dummy_file', valid, required)
コード例 #3
0
    def ParseIndex(self, index_data):
        if not index_data:
            return

        for info_files in index_data.split('\n\n'):
            info = pkg_info.ParsePkgInfo(info_files, self.filename,
                                         self.valid_keys, self.required_keys)
            debug = info['BUILD_CONFIG'] == 'debug'
            config = configuration.Configuration(info['BUILD_ARCH'],
                                                 info['BUILD_TOOLCHAIN'],
                                                 debug)
            key = (info['NAME'], config)
            if key in self.packages:
                error.Error('package index contains duplicate: %s' % str(key))
            self.packages[key] = info
コード例 #4
0
ファイル: package.py プロジェクト: protonpopsicle/Webports
    def ParseInfo(self, info_string):
        valid_keys = pkg_info.VALID_KEYS + self.extra_keys
        required_keys = pkg_info.REQUIRED_KEYS + self.extra_keys

        for key in valid_keys:
            if key in self.list_props:
                setattr(self, key, [])
            else:
                setattr(self, key, None)

        # Parse pkg_info file
        info = pkg_info.ParsePkgInfo(info_string, self.info, valid_keys,
                                     required_keys)

        # Set attributres based on pkg_info setttings.
        for key, value in info.items():
            setattr(self, key, value)

        self.Validate()
コード例 #5
0
ファイル: test_pkg_info.py プロジェクト: pvk84/naclports
 def testComments(self):
     result = pkg_info.ParsePkgInfo('NAME=foo # tail\n# line\nVERSION=bar',
                                    'dummy_file')
     self.assertEqual(result, {'NAME': 'foo', 'VERSION': 'bar'})
コード例 #6
0
ファイル: test_pkg_info.py プロジェクト: pvk84/naclports
 def testBalnkLine(self):
     result = pkg_info.ParsePkgInfo('NAME=foo\n\nVERSION=bar', 'dummy_file')
     self.assertEqual(result, {'NAME': 'foo', 'VERSION': 'bar'})
コード例 #7
0
ファイル: test_pkg_info.py プロジェクト: pvk84/naclports
 def testInvalidLine(self):
     expected_error = 'Invalid info line dummy_file:1'
     with self.assertRaisesRegexp(error.Error, expected_error):
         pkg_info.ParsePkgInfo('line without equals sign', 'dummy_file')