Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
IGNORED_DIRECTORIES = [
os.path.join('google', 'cloud', 'bigtable', '_generated'),
os.path.join('google', 'cloud', 'datastore', '_generated'),
'scripts/verify_included_modules.py',
]
IGNORED_FILES = [
os.path.join('docs', 'conf.py'),
]
IGNORED_POSTFIXES = [
os.path.join('google', '__init__.py'),
os.path.join('google', 'cloud', '__init__.py'),
'setup.py',
]
SCRIPTS_DIR = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -113,6 +116,9 @@ def make_test_rc(base_rc_filename, additions_dict,

def valid_filename(filename):
"""Checks if a file is a Python file and is not ignored."""
for postfix in IGNORED_POSTFIXES:
if filename.endswith(postfix):
return False
for directory in IGNORED_DIRECTORIES:
if filename.startswith(directory):
return False
Expand Down
26 changes: 18 additions & 8 deletions scripts/verify_included_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
'google.cloud.vision.__init__',
'google.cloud.vision.fixtures',
])
PACKAGES = (
'',
)


class SphinxApp(object):
Expand Down Expand Up @@ -120,8 +123,8 @@ def get_public_modules(path, base_package=None):
return result


def main(build_root='_build'):
"""Main script to verify modules included.
def verify_modules(build_root='_build'):
"""Verify modules included.

:type build_root: str
:param build_root: The root of the directory where docs are built into.
Expand All @@ -134,10 +137,12 @@ def main(build_root='_build'):
object_inventory_relpath)
sphinx_mods = set(inventory['py:module'].keys())

library_dir = os.path.join(BASE_DIR, 'google', 'cloud')
public_mods = get_public_modules(library_dir,
base_package='google.cloud')
public_mods = set(public_mods)
public_mods = set()
for package in PACKAGES:
library_dir = os.path.join(BASE_DIR, package, 'google', 'cloud')
package_mods = get_public_modules(library_dir,
base_package='google.cloud')
public_mods.update(package_mods)

if not sphinx_mods <= public_mods:
unexpected_mods = sphinx_mods - public_mods
Expand Down Expand Up @@ -172,7 +177,12 @@ def get_parser():
return parser


if __name__ == '__main__':
def main():
"""Main script to verify modules included."""
parser = get_parser()
args = parser.parse_args()
main(build_root=args.build_root)
verify_modules(build_root=args.build_root)

This comment was marked as spam.

This comment was marked as spam.



if __name__ == '__main__':
main()