33 |
""" |
""" |
34 |
listdir(path, extensions, dirs=0) |
listdir(path, extensions, dirs=0) |
35 |
|
|
36 |
Quite specialized listdir, which returns all directories and files |
Quite specialized listdir, which return all directories and files |
37 |
with specific extensions under given path. Nonrecursive. |
with specific extensions under given path. Nonrecursive. |
38 |
|
|
39 |
Skipping files starting with '.' or including some of 'CVS', '#', '~'. |
Skipping files starting with '.' or including some of 'CVS', '#', '~'. |
52 |
""" |
""" |
53 |
slashify(path) |
slashify(path) |
54 |
|
|
55 |
Ends path with a trailing slash, if still necessary. |
End path with a trailing slash, if still necessary. |
56 |
""" |
""" |
57 |
if len(path) > 0: |
if len(path) > 0: |
58 |
return (path+'/').replace('//','/') |
return (path+'/').replace('//','/') |
62 |
""" |
""" |
63 |
relative_path(source, target) |
relative_path(source, target) |
64 |
|
|
65 |
Returns a relative filepath from the source filepath to the target |
Return a relative filepath from the source filepath to the target |
66 |
filepath. |
filepath. |
67 |
""" |
""" |
68 |
import config |
import config |
70 |
|
|
71 |
if source == None or len(source) == 0: return target |
if source == None or len(source) == 0: return target |
72 |
|
|
|
## Condition removed because because of docutils sending |
|
|
# relative and absolute paths mixed. |
|
|
# |
|
|
# if source.startswith('../') or target.startswith('../'): |
|
73 |
source = os.path.normpath(os.path.abspath(source)) |
source = os.path.normpath(os.path.abspath(source)) |
74 |
target = os.path.normpath(os.path.abspath(target)) |
target = os.path.normpath(os.path.abspath(target)) |
75 |
|
|