File indexing completed on 2024-04-21 03:52:27

0001 #! /usr/bin/env python3
0002 # -*- coding: utf-8 -*-
0003 #
0004 # SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kdemail.net>
0005 # SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
0006 # SPDX-FileCopyrightText: 2014 Alex Turbov <i.zaufi@gmail.com>
0007 # SPDX-FileCopyrightText: 2016 Olivier Churlaud <olivier@churlaud.com>
0008 #
0009 # SPDX-License-Identifier: BSD-2-Clause
0010 
0011 import logging
0012 import codecs
0013 import os
0014 import sys
0015 import time
0016 import datetime
0017 
0018 from kapidox import generator, utils, argparserutils, preprocessing, hlfunctions
0019 
0020 try:
0021     from kapidox import depdiagram
0022     DEPDIAGRAM_AVAILABLE = True
0023 except ImportError:
0024     DEPDIAGRAM_AVAILABLE = False
0025 
0026 
0027 def get_identities():
0028     """Extract account information from the file (if any) specified with
0029        the `--accountsfile` command-line argument.
0030        An account file is a whitespace-separated file with a first "column"
0031        specifying the account name, the last "column" specifying an email
0032        address, and all the columns in between are a name, e.g.
0033 
0034        adridg Adriaan de Groot groot@kde.org
0035 
0036        This line has three "columns" for the name.
0037     """
0038     maintainers = {}
0039 
0040     args = argparserutils.parse_args(DEPDIAGRAM_AVAILABLE)
0041     if args.accountsfile and os.path.exists(args.accountsfile):
0042         logging.debug("Found contributor identities file at %s", args.accountsfile)
0043         with codecs.open(args.accountsfile, 'r', encoding='utf8') as f:
0044             for line in f:
0045                 parts = line.strip().split()
0046                 if len(parts) >= 3:
0047                     maintainers[parts[0]] = {
0048                         'name': ' '.join(parts[1:-1]),
0049                         'email': parts[-1]
0050                         }
0051 
0052     else:
0053         logging.debug("No contributor identities file specified. Without the "
0054                       "file, maintainer information will be incomplete. For "
0055                       "generating KDE API documentation you can download the "
0056                       "KDE accounts file from https://websvn.kde.org/*check"
0057                       "out*/trunk/kde-common/accounts and specify it with the "
0058                       "--accountsfile argument.")
0059 
0060     return maintainers
0061 
0062 
0063 def main():
0064     kde_copyright = '1996-' + str(datetime.date.today().year) + ' The KDE developers'
0065     get_maintainers = get_identities
0066 
0067     hlfunctions.do_it(maintainers_fct=get_maintainers,
0068                       copyright=kde_copyright)
0069 
0070 
0071 if __name__ == "__main__":
0072     main()