1 |
Hi gang. |
2 |
|
3 |
I have whipped up a dohtml script (in spython, it became very clumsy in |
4 |
bash), attached. |
5 |
|
6 |
The goals of the script are: |
7 |
) It should (optionally) be recursive |
8 |
) One should be able to specify the extensions for files that are allowed |
9 |
to |
10 |
be copied (default mask is png, jpg, html, htm and css) |
11 |
) One should be able to specify the names of directories that are not to |
12 |
be |
13 |
copied (default mask is CVS). |
14 |
) One should be able to specify directories and files |
15 |
) The files should of course not be compressed, like with dodoc, since |
16 |
browsers |
17 |
don't like .html.gz. |
18 |
|
19 |
|
20 |
Usage: |
21 |
|
22 |
dohtml [-a ext,ext,ext] [-x dir,dir,dir] [-r] files... |
23 |
|
24 |
-a will take a comma-separated list of extensions that are allowed, |
25 |
default is |
26 |
png,html,htm,jpg,css |
27 |
|
28 |
-x will take a comma-separated list of directories to ignore, default is |
29 |
CVS |
30 |
|
31 |
-r will force the script to recurse into subdirectories |
32 |
|
33 |
files is a list of files and directories that will be copied. |
34 |
|
35 |
The gist of the script is as follows: For each of the files specified, it |
36 |
checks if it is a file and that its extension is allowed, if so, it is |
37 |
copied into ${D}usr/share/doc/${PF}/html. |
38 |
|
39 |
If it is a directory, its name is allowed (not in the -x list) and -r is |
40 |
enabled, the script recurses into the directory and reapplies itself. When |
41 |
recursing, directory structure will of course be kept. |
42 |
|
43 |
Examples: |
44 |
|
45 |
dohtml -a html doc/* |
46 |
|
47 |
will copy all .html files in doc/ into ${D}usr/share/doc/${PF}/html/ |
48 |
|
49 |
dohtml -r doc/* |
50 |
|
51 |
will copy all .{html,png,htm,jpg,css} files into |
52 |
${D}usr/share/doc/${PF}/html/, |
53 |
retaining the directory structure under doc, like cp -R doc/* would. |
54 |
|
55 |
Current shortcomings: |
56 |
- The script uses os.link() to do the actual copying. This is really not |
57 |
what we |
58 |
want. Does anybody know of a function in the Python standard library |
59 |
that does |
60 |
an actual copy ? |
61 |
- The files are not chmod 0644'ed, but this will be fixed as the os.link() |
62 |
is |
63 |
fixed. |
64 |
|
65 |
|
66 |
Did I forget something here ? |
67 |
|
68 |
|
69 |
Kind regards, |
70 |
|
71 |
Karl T |
72 |
|
73 |
PS. There are semantical differences between executing |
74 |
string.split(str,",") and |
75 |
string.split(str,',') in spython and python, for some reason. Script uses |
76 |
latter so it works in both. |