Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/build_config/buildPyDoc.py
169673 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2011-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file buildPyDoc.py
15
# @author Daniel Krajzewicz
16
# @author Michael Behrisch
17
# @date 2011-10-20
18
19
"""
20
Generates pydoc files for all python libraries.
21
"""
22
from __future__ import absolute_import
23
from __future__ import print_function
24
import os
25
import sys
26
import shutil
27
import pydoc
28
import types
29
from optparse import OptionParser
30
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
31
import traci # noqa
32
import sumolib # noqa
33
from sumolib.miscutils import working_dir # noqa
34
35
36
def pydoc_recursive(module):
37
pydoc.writedoc(module)
38
for submod in module.__dict__.values():
39
if isinstance(submod, types.ModuleType) and submod.__name__.startswith(module.__name__):
40
pydoc_recursive(submod)
41
42
43
optParser = OptionParser()
44
optParser.add_option("-p", "--pydoc-output", help="output folder for pydoc")
45
optParser.add_option("-c", "--clean", action="store_true", default=False, help="remove output dirs")
46
(options, args) = optParser.parse_args()
47
48
if options.pydoc_output:
49
if options.clean:
50
shutil.rmtree(options.pydoc_output, ignore_errors=True)
51
os.mkdir(options.pydoc_output)
52
with working_dir(options.pydoc_output):
53
for module in (traci, sumolib):
54
pydoc_recursive(module)
55
56