1 from subprocess
import call
3 from commands
import getstatusoutput
5 import sys
, ConfigParser
, os
.path
, re
7 from layman
.config
import Config
8 from layman
.action
import *
9 from layman
.db
import DB
11 here
= os
.path
.split(os
.path
.realpath(__file__
))[0]
15 """add overlays and sync them"""
17 command1
= "./layman -c mylayman.cfg -a ALL"
19 (status
, output
) = getstatusoutput(command1
)
24 command2 = "./layman -c mylayman.cfg -s ALL"
25 getstatusoutput(command2)
27 print command1, "\n", command2
31 """return overlays dict"""
34 sys
.argv
.append('mylayman.cfg')
45 for name
, overlay
in db
.overlays
.items():
46 overlays
[name
] = dict()
47 overlays
[name
]["src"] = overlay
.src
48 overlays
[name
]["contact"] = overlay
.contact
50 description
= overlay
.description
51 description
= re
.compile(u
' +').sub(u
' ', description
)
52 description
= re
.compile(u
'\n ').sub(u
'\n', description
)
54 overlays
[name
]["description"] = description
56 if '<link>1' in overlay
.data
.keys():
57 link
= overlay
.data
['<link>1']['@'].strip()
58 link
= re
.compile(u
' +').sub(u
' ', link
)
59 link
= re
.compile(u
'\n ').sub(u
'\n', link
)
63 overlays
[name
]["link"] = link
71 if __name__
== '__main__':