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))
Exemplo n.º 2
0
def catkinize_package(path, version):
    """
    Calculates a list of changes for one package. changes are 4-tupels of oldfile, backupfile, newfile, contents.
    This comes before execution so that the user may confirm or reject changes.
    """
    if not os.path.isdir(path):
        raise ValueError('No directory found at %s' % path)
    manifest_path = os.path.join(path, 'manifest.xml')

    if not os.path.isfile(manifest_path):
        raise ValueError("No rosbuild package at %s, missing manifest.xml" % manifest_path)
    new_manifest = convert_manifest(path, manifest_path, version)
    new_cmake = convert_cmake(path)

    filenames = ['CMakeLists.txt', 'manifest.xml', 'Makefile']
    newfiles = ['CMakeLists.txt', 'package.xml', None]
    contents = [new_cmake, new_manifest, None]

    return _create_changesets(path, filenames, newfiles, contents)
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))
Exemplo n.º 4
0
def catkinize_package(path, version):
    """
    Calculates a list of changes for one package. changes are 4-tupels of oldfile, backupfile, newfile, contents.
    This comes before execution so that the user may confirm or reject changes.
    """
    if not os.path.isdir(path):
        raise ValueError('No directory found at %s' % path)
    manifest_path = os.path.join(path, 'manifest.xml')

    if not os.path.isfile(manifest_path):
        raise ValueError("No rosbuild package at %s, missing manifest.xml" % manifest_path)
    new_manifest = convert_manifest(path, manifest_path, version)
    new_cmake = convert_cmake(path)

    filenames = ['CMakeLists.txt', 'manifest.xml', 'Makefile']
    newfiles = ['CMakeLists.txt', 'package.xml', None]
    contents = [new_cmake, new_manifest, None]

    return _create_changesets(path, filenames, newfiles, contents)
Exemplo n.º 5
0
def catkinize_package(path, version, maintainer_emails):
    """
    Calculates a list of changes for one package.

    Changes are 4-tupels of oldfile, backupfile, newfile, contents.  This comes
    before execution so that the user may confirm or reject changes.
    """
    if not os.path.isdir(path):
        raise ValueError('No directory found at %s' % path)
    manifest_path = os.path.join(path, 'manifest.xml')

    if not os.path.isfile(manifest_path):
        raise ValueError(
            "No rosbuild package at %s, missing manifest.xml" % manifest_path)

    # add PATH/src/NAME/__init__.py if *.py exists in PATH/src/NAME (because rosbuild did)
    package_name = os.path.basename(os.path.abspath(path))
    print(package_name)
    if any(filename.endswith('.py')
            for dirpath, dirnames, filenames in os.walk(os.path.join(path, 'src', package_name))
            for filename in filenames):
        if not os.path.exists(os.path.join(path, 'src', package_name, '__init__.py')):
            with open(os.path.join(path, 'src', package_name, '__init__.py'), 'wb') as f:
                pass

    # build the content of the potential new CMakeLists.txt and packaeg.xml
    new_manifest = convert_manifest(path, manifest_path, version,
        maintainer_emails=maintainer_emails)
    new_cmake = convert_cmake(path)
    
    filenames = ['CMakeLists.txt', 'manifest.xml', 'Makefile']
    newfiles = ['CMakeLists.txt', 'package.xml', None]
    contents = [new_cmake, new_manifest, None]
    
    if utils.get_python_packages(path):
        filenames.append('setup.py')
        newfiles.append('setup.py')
        contents.append(generate_setup_py(path))

    return _create_changesets(path, filenames, newfiles, contents)