def main():
    parser = argparse.ArgumentParser(prog='index2devhelp')
    parser.add_argument('book_base',
                        type=str,
                        help='url to the location of the book')
    parser.add_argument('chapters_path',
                        type=str,
                        help='path to the chapters file to include')
    parser.add_argument('book_title', type=str, help='the title of the book')
    parser.add_argument('book_name', type=str, help='the name of the package')
    parser.add_argument('rel_link',
                        type=str,
                        help='the link relative to the root of the '
                        'documentation')
    parser.add_argument('in_fn', type=str, help='the path of the source file')
    parser.add_argument('dest_fn',
                        type=str,
                        help='the path of the destination file')
    args = parser.parse_args()

    with open(args.dest_fn, 'wb') as out_f:
        output = transform_devhelp(args.book_title, args.book_name,
                                   args.book_base, args.rel_link,
                                   args.chapters_path, args.in_fn)
        out_f.write(output)
Example #2
0
    def test_transform_devhelp(self):
        dir_path = os.path.dirname(__file__)
        chapters_fn = os.path.join(dir_path,
                                   'transform_data/index-chapters-cpp.xml')
        functions_fn = os.path.join(dir_path,
                                    'transform_data/index-functions-cpp.xml')
        expected_path = os.path.join(dir_path, 'devhelp_data/expected.xml')
        dest_path = os.path.join(dir_path, 'devhelp_data/result.xml')

        with open(expected_path, 'rb') as expected_f:
            expected = expected_f.read()

        result = transform_devhelp('book_title', 'book_name', 'book_base',
                                   'rel_link', chapters_fn, functions_fn)

        if expected != result:
            with open(dest_path, 'wb') as result_f:
                result_f.write(result)

        self.assertEqual(expected, result)
Example #3
0
    def test_transform_devhelp(self):
        dir_path = os.path.dirname(__file__)
        chapters_fn = os.path.join(
            dir_path, 'transform_data/index-chapters-cpp.xml')
        functions_fn = os.path.join(
            dir_path, 'transform_data/index-functions-cpp.xml')
        expected_path = os.path.join(
            dir_path, 'devhelp_data/expected.xml')
        dest_path = os.path.join(dir_path, 'devhelp_data/result.xml')

        with open(expected_path, 'rb') as expected_f:
            expected = expected_f.read()

        result = transform_devhelp('book_title', 'book_name', 'book_base',
                                   'rel_link', chapters_fn, functions_fn)

        if expected != result:
            with open(dest_path, 'wb') as result_f:
                result_f.write(result)

        self.assertEqual(expected, result)