summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/mkHelpSkeleton10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/mkHelpSkeleton b/scripts/mkHelpSkeleton
index ffb21c2..d7914fe 100755
--- a/scripts/mkHelpSkeleton
+++ b/scripts/mkHelpSkeleton
@@ -1,97 +1,95 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2""" 2"""
3This skript creates a help skeleton for a certain application 3This skript creates a help skeleton for a certain application
4(C) Michael 'Mickey' Lauer who did this even if he had a lot of other stuff to do... 4(C) Michael 'Mickey' Lauer who did this even if he had a lot of other stuff to do... THANKS
5""" 5"""
6 6
7import os 7import os
8import sys 8import sys
9 9
10COUNTRYCODES = "da de en fr nl pl hu no pt it pt_BR ja sl zh_CN es ko zh_TW".split() 10COUNTRYCODES = "da de en fr nl pl hu no pt it pt_BR ja sl zh_CN es ko zh_TW".split()
11OPIEDIR = os.environ["OPIEDIR"] 11OPIEDIR = os.environ["OPIEDIR"]
12 12
13#Package: opie-appskey-help-en 13#Package: opie-appskey-help-en
14#Files: help/en/html/opie-appskey.html 14#Files: help/en/html/opie-appskey.html
15#Priority: optional 15#Priority: optional
16#Section: opie/onlinedoc 16#Section: opie/onlinedoc
17#Maintainer: ljp <llornkcor@handhelds.org> 17#Maintainer: ljp <llornkcor@handhelds.org>
18#Architecture: arm 18#Architecture: arm
19#Version: $QPE_VERSION-$SUB_VERSION 19#Version: $QPE_VERSION-$SUB_VERSION
20#Depends: opie-appskey 20#Depends: opie-appskey
21#License: GPL 21#License: GPL
22#Description: Application Key help files (english) 22#Description: Application Key help files (english)
23 23
24def doit( name, cc ): 24def doit( name, cc ):
25 """Create a help skeleton corresponding to a package described by a desktop file.""" 25 """Create a help skeleton corresponding to a package described by a desktop file."""
26 26
27 desktop = {} 27 desktop = {}
28 for line in file( name ): 28 for line in file( name ):
29 try: 29 try:
30 key, value = line.split( '=' ) 30 key, value = line.split( '=' )
31 except ValueError: 31 except ValueError:
32 pass 32 pass
33 else: 33 else:
34 desktop[key.strip()] = value.strip() 34 desktop[key.strip()] = value.strip()
35 35
36 try: 36 try:
37 application = desktop["Exec"] 37 application = desktop["Exec"]
38 except: 38 except:
39 fail( "No Exec given in .desktop file" ) 39 fail( "No Exec given in .desktop file" )
40 40
41 print "Generating help skeleton for application '%s'..." % application 41 print "Generating help skeleton for application '%s'..." % application
42 helpdirname = "%s/help/%s/html" % ( OPIEDIR, cc ) 42 helpdirname = "%s/help/%s/html" % ( OPIEDIR, cc )
43 helpappdirname = "%s/%s" % ( helpdirname, application ) 43 helpappdirname = "%s/%s" % ( helpdirname, application )
44 makecontrol( helpdirname, application, cc, desktop ) 44 makecontrol( helpdirname, application, cc, desktop )
45 makedir( helpappdirname ) 45 makedir( helpappdirname )
46 makehtml( helpdirname, application, cc, desktop ) 46 makehtml( helpdirname, application, cc, desktop )
47 47
48#------------------------------------------------------# 48#------------------------------------------------------#
49def makehtml( directory, application, cc, desktop ): 49def makehtml( directory, application, cc, desktop ):
50 """Creates the help template file.""" 50 """Creates the help template file."""
51 51
52 helpfilename = "%s/opie-%s.html" % ( directory, application ) 52 helpfilename = "%s/%s.html" % ( directory, application )
53 print "Creating help file '%s'" % helpfilename 53 print "Creating help file '%s'" % helpfilename
54 h = file( helpfilename, "w" ) 54 h = file( helpfilename, "w" )
55 print >> h, """ 55 print >> h, """<html> <head> <title>%s</title> </head>
56<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
57<html> <head> <title>%s</title> </head>
58<body> 56<body>
59 <center><h1>%s</h1></center> 57 <center><h1>%s</h1></center>
60 <hr> 58 <hr>
61</body> 59</body>
62</html> 60</html>
63""" % ( application, application ) 61""" % ( application, application )
64 62
65#------------------------------------------------------# 63#------------------------------------------------------#
66def makecontrol( directory, application, cc, desktop ): 64def makecontrol( directory, application, cc, desktop ):
67 """Creates the .control file.""" 65 """Creates the .control file."""
68 66
69 controlfilename = "%s/opie-%s-help-%s.control" % ( directory, application, cc ) 67 controlfilename = "%s/opie-%s-help-%s.control" % ( directory, application, cc )
70 print "Creating control file '%s'" % controlfilename 68 print "Creating control file '%s'" % controlfilename
71 c = file( controlfilename, "w" ) 69 c = file( controlfilename, "w" )
72 print >> c, "Package: opie-%s-help-%s" % ( application, cc ) 70 print >> c, "Package: opie-%s-help-%s" % ( application, cc )
73 print >> c, "Files: help/%s/html/opie-%s.html help/%s/html/%s" % ( cc, application, cc, application ) 71 print >> c, "Files: help/%s/html/%s.html help/%s/html/%s" % ( cc, application, cc, application )
74 print >> c, "Priority: optional" 72 print >> c, "Priority: optional"
75 print >> c, "Section: opie/onlinedoc" 73 print >> c, "Section: opie/onlinedoc"
76 print >> c, "Maintainer: %s" % desktop.get( "Maintainer", "Team Opie <opie@handhelds.org>" ) 74 print >> c, "Maintainer: %s" % desktop.get( "Maintainer", "Team Opie <opie@handhelds.org>" )
77 print >> c, "Version: $QPE_VERSION-$SUB_VERSION" 75 print >> c, "Version: $QPE_VERSION-$SUB_VERSION"
78 print >> c, "Depends: opie-%s" % application 76 print >> c, "Depends: opie-%s" % application
79 print >> c, "License: GPL" 77 print >> c, "License: GPL"
80 print >> c, "Description: %s help files (%s)" % ( application, cc ) 78 print >> c, "Description: %s help files (%s)" % ( application, cc )
81 79
82#------------------------------------------------------# 80#------------------------------------------------------#
83def makedir( name ): 81def makedir( name ):
84 """Creates a directory.""" 82 """Creates a directory."""
85 83
86 print "Creating directory '%s'" % name 84 print "Creating directory '%s'" % name
87 if not os.path.exists( name ): os.mkdir( name ) 85 if not os.path.exists( name ): os.mkdir( name )
88 86
89#------------------------------------------------------# 87#------------------------------------------------------#
90def fail( reason ): 88def fail( reason ):
91 """Fails with a reason.""" 89 """Fails with a reason."""
92 print reason 90 print reason
93 sys.exit( -1 ) 91 sys.exit( -1 )
94 92
95#------------------------------------------------------# 93#------------------------------------------------------#
96def checkUsage( args ): 94def checkUsage( args ):
97 """Checks calling syntax.""" 95 """Checks calling syntax."""