Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

Make the exclude options be regex #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
12 changes: 2 additions & 10 deletions javasphinx/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cPickle as pickle

import logging
import re
import sys
import os
import os.path
Expand Down Expand Up @@ -201,20 +202,12 @@ def generate_documents(source_files, cache_dir, verbose):

return packages, documents, sources

def normalize_excludes(rootpath, excludes):
f_excludes = []
for exclude in excludes:
if not os.path.isabs(exclude) and not exclude.startswith(rootpath):
exclude = os.path.join(rootpath, exclude)
f_excludes.append(os.path.normpath(exclude) + os.path.sep)
return f_excludes

def is_excluded(root, excludes):
sep = os.path.sep
if not root.endswith(sep):
root += sep
for exclude in excludes:
if root.startswith(exclude):
if re.search(exclude, root) != None:
return True
return False

Expand Down Expand Up @@ -279,7 +272,6 @@ def main(argv=sys.argv):
if opts.cache_dir and not os.path.isdir(opts.cache_dir):
os.makedirs(opts.cache_dir)

excludes = normalize_excludes(rootpath, excludes)
source_files = []

for input_path in input_paths:
Expand Down