27 |
|
|
28 |
import os.path |
import os.path |
29 |
|
|
30 |
def _rstFiles(path): |
def _listdir(path, extensions, dirs=0): |
31 |
""" |
""" |
32 |
Returns all ".rst" files under path. Nonrecursive. |
Returns all directories and files with specific |
33 |
|
extensions under path. Nonrecursive. |
34 |
""" |
""" |
35 |
files = [f for f in os.listdir(_slashify(path)) \ |
files = [f for f in os.listdir(path) if not f.startswith('.') |
36 |
if os.path.isfile(_slashify(path)+f) and not f.startswith('.') |
and not f == "CVS" and '#' not in f and '~' not in f] |
37 |
and '#' not in f and '~' not in f] |
if not dirs: |
38 |
rstfiles = [f for f in files if f.endswith('.rst')] |
files = [f for f in os.listdir(path) if os.path.isfile(_slashify(path)+f)] |
39 |
return rstfiles |
files = [f for f in files if extensions.count(f.split('.')[-1]) > 0] |
40 |
|
return files |
41 |
|
|
42 |
def _slashify(path): |
def _slashify(path): |
43 |
""" |
""" |