| 1 |
#! /usr/bin/env python3 |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
# |
| 4 |
# SPDX-FileCopyrightText: 2014 Alex Merry <[email protected]> |
| 5 |
# SPDX-FileCopyrightText: 2014 Aurélien Gâteau <[email protected]> |
| 6 |
# SPDX-FileCopyrightText: 2014 Alex Turbov <[email protected]> |
| 7 |
# SPDX-FileCopyrightText: 2016 Olivier Churlaud <[email protected]> |
| 8 |
# |
| 9 |
# SPDX-License-Identifier: BSD-2-Clause |
| 10 |
|
| 11 |
import logging |
| 12 |
import codecs |
| 13 |
import os |
| 14 |
import sys |
| 15 |
import time |
| 16 |
import datetime |
| 17 |
|
| 18 |
from kapidox import generator, utils, argparserutils, preprocessing, hlfunctions |
| 19 |
|
| 20 |
try: |
| 21 |
from kapidox import depdiagram |
| 22 |
DEPDIAGRAM_AVAILABLE = True |
| 23 |
except ImportError: |
| 24 |
DEPDIAGRAM_AVAILABLE = False |
| 25 |
|
| 26 |
|
| 27 |
def get_identities(): |
| 28 |
"""Extract account information from the file (if any) specified with |
| 29 |
the `--accountsfile` command-line argument. |
| 30 |
An account file is a whitespace-separated file with a first "column" |
| 31 |
specifying the account name, the last "column" specifying an email |
| 32 |
address, and all the columns in between are a name, e.g. |
| 33 |
|
| 34 |
adridg Adriaan de Groot [email protected] |
| 35 |
|
| 36 |
This line has three "columns" for the name. |
| 37 |
""" |
| 38 |
maintainers = {} |
| 39 |
|
| 40 |
args = argparserutils.parse_args(DEPDIAGRAM_AVAILABLE) |
| 41 |
if args.accountsfile and os.path.exists(args.accountsfile): |
| 42 |
logging.debug("Found contributor identities file at %s", args.accountsfile) |
| 43 |
with codecs.open(args.accountsfile, 'r', encoding='utf8') as f: |
| 44 |
for line in f: |
| 45 |
parts = line.strip().split() |
| 46 |
if len(parts) >= 3: |
| 47 |
maintainers[parts[0]] = { |
| 48 |
'name': ' '.join(parts[1:-1]), |
| 49 |
'email': parts[-1] |
| 50 |
} |
| 51 |
|
| 52 |
else: |
| 53 |
logging.debug("No contributor identities file specified. Without the " |
| 54 |
"file, maintainer information will be incomplete. For " |
| 55 |
"generating KDE API documentation you can download the " |
| 56 |
"KDE accounts file from https://websvn.kde.org/*check" |
| 57 |
"out*/trunk/kde-common/accounts and specify it with the " |
| 58 |
"--accountsfile argument.") |
| 59 |
|
| 60 |
return maintainers |
| 61 |
|
| 62 |
|
| 63 |
def main(): |
| 64 |
kde_copyright = '1996-' + str(datetime.date.today().year) + ' The KDE developers' |
| 65 |
get_maintainers = get_identities |
| 66 |
|
| 67 |
hlfunctions.do_it(maintainers_fct=get_maintainers, |
| 68 |
copyright=kde_copyright) |
| 69 |
|
| 70 |
|
| 71 |
if __name__ == "__main__": |
| 72 |
main() |