def main(): usage = 'usage: %prog [options] manifest_xml_path package_name version' parser = OptionParser(usage) parser.add_option('-a', '--architecture_independent', dest='architecture_independent', action='store_true', default=False, help='Whether the package runs on all platforms') parser.add_option('-m', '--metapackage', dest='metapackage', action='store_true', default=False, help='Whether this package is a metapackage') parser.add_option('-b', '--bugtracker_url', dest='bugtracker_url', type='string', default='', help='URL for issues related to this package') parser.add_option('-r', '--replaces', dest='replaces', type='string', default='', help='Comma-separated list of packages replaced by ' + 'this package') parser.add_option('-c', '--conflicts', dest='conflicts', type='string', default='', help='Comma-separated list of pkgs conflicting ' + 'with this package') options, args = parser.parse_args() if len(args) != 3: parser.error('wrong number of arguments %s' % len(args)) manifest_xml_path = args[0] version = args[2] if not is_valid_version(version): parser.error("The version must have the format: \d.\d.\d") print( convert_manifest(os.path.dirname(manifest_xml_path), manifest_xml_path, version, options.architecture_independent, options.metapackage, options.bugtracker_url, options.replaces, options.conflicts))
def main(): usage = 'usage: %prog [options] manifest_xml_path package_name version' parser = OptionParser(usage) parser.add_option('-a', '--architecture_independent', dest='architecture_independent', action='store_true', default=False, help='Whether the package runs on all platforms') parser.add_option('-m', '--metapackage', dest='metapackage', action='store_true', default=False, help='Whether this package is a metapackage') parser.add_option('-b', '--bugtracker_url', dest='bugtracker_url', type='string', default='', help='URL for issues related to this package') parser.add_option('-r', '--replaces', dest='replaces', type='string', default='', help='Comma-separated list of packages replaced by ' + 'this package') parser.add_option('-c', '--conflicts', dest='conflicts', type='string', default='', help='Comma-separated list of pkgs conflicting ' + 'with this package') options, args = parser.parse_args() if len(args) != 3: parser.error('wrong number of arguments %s' % len(args)) manifest_xml_path = args[0] version = args[2] if not is_valid_version(version): parser.error("The version must have the format: \d.\d.\d") print(convert_manifest(os.path.dirname(manifest_xml_path), manifest_xml_path, version, options.architecture_independent, options.metapackage, options.bugtracker_url, options.replaces, options.conflicts))
def main(): usage = 'usage: %prog path version' description = '''\ catkinize backups your rosbuild build files with ".backup" extension and \ creates new build files for catkin. New files are heuristically build from \ old files and will most probably need additional manual changes before \ working with catkin.''' parser = OptionParser(usage=usage, description=description) options, args = parser.parse_args() if len(args) != 2: parser.error("You must specify 'path' and 'version' of the package.") path = args[0] version = args[1] if not is_valid_version(version): parser.error("The version must have the format: \d.\d.\d") changeset = catkinize_package(path, version) if prompt_changes(changeset): perform_changes(changeset)
def test_valid_versions(self): self.assertTrue(is_valid_version('0.1.0')) self.assertTrue(is_valid_version('0.12.0')) self.assertTrue(is_valid_version('0.123.0')) self.assertTrue(is_valid_version('5.123.9'))
def test_invalid_versions(self): self.assertFalse(is_valid_version('0.1')) self.assertFalse(is_valid_version('0.12.a')) self.assertFalse(is_valid_version('0.')) self.assertFalse(is_valid_version('123.9.5.2'))