1- #!/usr/bin/env python3
1+ # Licensed to the Software Freedom Conservancy (SFC) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The SFC licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
28#
3- # This script recursively scans the `selenium` package directory to find all
4- # modules, then generates the `py/docs/source/api.rst` file containing a
5- # listing of all modules in separate sections. The `api.rst` file is later
6- # used by `sphinx-autogen` to generate sphinx autodoc stub pages used in the
7- # Python API documentation. See `py/tox.ini` for how it is invoked.
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
817
18+ # -----------------------------------------------------------------
19+ # This script recursively scans the `selenium` package directory
20+ # to find all modules, then generates the `py/docs/source/api.rst`
21+ # file containing a listing of all modules in separate sections.
22+ # The `api.rst` file is later used by `sphinx-autogen` to generate
23+ # sphinx autodoc stub pages used in the Python API documentation.
24+ # See `py/tox.ini` for how it is invoked.
925
10- import importlib .util
1126import os
1227import site
1328
@@ -33,11 +48,7 @@ def find_modules(package_name):
3348 output_file = os .path .join ("docs" , "source" , "api.rst" )
3449 print (f"generating module list for sphinx autodoc in: { output_file } \n " )
3550 modules = find_modules (package_name )
36- base_modules = [
37- mod
38- for mod in sorted (set (module .rsplit ("." , 1 )[0 ] for module in modules ))
39- if mod != package_name
40- ]
51+ base_modules = [mod for mod in sorted (set (module .rsplit ("." , 1 )[0 ] for module in modules )) if mod != package_name ]
4152 print ("found sections:" )
4253 for base_module in base_modules :
4354 print (f" { base_module } " )
@@ -73,7 +84,7 @@ def find_modules(package_name):
7384 if base_module in module :
7485 f .write (f" { module } \n " )
7586 f .write (
76- f """
87+ """
7788Indices and tables
7889
7990* :ref:`genindex`
0 commit comments