def main(): parser = argparse.ArgumentParser() parser.add_argument( 'new_version', help='the new version being proposed', ) parser.add_argument( 'existing_versions', nargs='*', help='the existing versions in the repository', ) args = parser.parse_args() new_version = semver.parse_version(args.new_version) if len(new_version) < 3: new_version = new_version + [0] existing_versions = sorted( [semver.parse_version(v) for v in args.existing_versions]) msgs = semver.sanity_check_version(new_version, existing_versions) for msg in msgs: print(msg) return 1 if msgs else 0
def main(): parser = argparse.ArgumentParser() parser.add_argument( 'new_version', help='the new version being proposed', ) parser.add_argument( 'existing_versions', nargs='*', help='the existing versions in the repository', ) args = parser.parse_args() new_version = semver.parse_version(args.new_version) if len(new_version) < 3: new_version = new_version + [0] existing_versions = sorted([ semver.parse_version(v) for v in args.existing_versions ]) msgs = semver.sanity_check_version(new_version, existing_versions) for msg in msgs: print(msg) return 1 if msgs else 0
def test_short(self): self.assertEqual([1, 1, 0], semver.parse_version('1.1'))
def test_not_int(self): self.assertEqual([1, 'a', 1], semver.parse_version('1.a.1'))
def test_all_ints(self): self.assertEqual([1, 0, 1], semver.parse_version('1.0.1'))