Beispiel #1
0
    def load(self, root, package, bump_version):
        self.options = read_yaml_exit(package,
                                      "Error: no %s file found!" % package)

        if bump_version:
            majv, minv = validate_version(
                unicode(self.options.get('version', '0.0')))
            self.options['version'] = "%s.%s" % (majv, minv + 1)
            with open(package, 'w') as f:
                yaml.dump(self.options,
                          f,
                          default_flow_style=False,
                          allow_unicode=True)
        else:
            majv, minv = validate_version(
                unicode(self.options.get('version', '0.0')))
            self.options['version'] = "%s.%s" % (majv, minv)

        self.root = find_root(root)
        if self.root is not None:
            self.options['rootfile'] = self.root
            root_options = read_yaml_exit(os.path.join(self.root, root))
            root_options.update(self.options)
            self.options = root_options

        print "Building %(project)s-%(name)s version %(version)s" % self.options
        return True
Beispiel #2
0
 def test_validate_version(self):
     for version in pfif.PFIF_VERSIONS:
         assert utils.validate_version(version) == pfif.PFIF_VERSIONS[
             version]
     assert utils.validate_version('') == pfif.PFIF_VERSIONS[
         pfif.PFIF_DEFAULT_VERSION]
     raises(Exception, utils.validate_version, '1.0')
Beispiel #3
0
 def test_validate_version(self):
     for version in pfif.PFIF_VERSIONS:
         assert utils.validate_version(
             version) == pfif.PFIF_VERSIONS[version]
     assert utils.validate_version('') == pfif.PFIF_VERSIONS[
         pfif.PFIF_DEFAULT_VERSION]
     raises(Exception, utils.validate_version, '1.0')
Beispiel #4
0
 def test_validate_version(self):
     for version in pfif.PFIF_VERSIONS:
         assert utils.validate_version(version) == version
     assert utils.validate_version('') == ''
     assert_raises(Exception, utils.validate_version, '1.0')
Beispiel #5
0
 def test_validate_version(self):
     for version in pfif.PFIF_VERSIONS: 
         assert utils.validate_version(version) == version
     assert utils.validate_version('') == ''
     assert_raises(Exception, utils.validate_version, '1.0')