Project

General

Profile

1
import os
2
import pysvn
3
import pystache
4
import json
5
import shutil
6

    
7

    
8
class DeployModule(object):
9
    def __init__(self, name=None, type_source=None, version=None, url=None, mail=None, deploy_repository=None,
10
                 deploy_repository_url=None, goal=None, dict_values=None, cron=None):
11
        if not dict_values:
12
            self.name = name
13
            self.type_source = type_source
14
            self.version = version
15
            self.url = url
16
            self.mail = mail
17
            self.goal = goal
18
            self.deploy_repository = deploy_repository
19
            self.deploy_repository_url = deploy_repository_url
20
            self.cron = cron
21
        else:
22
            self.name = dict_values['name']
23
            self.type_source = dict_values['type_source']
24
            self.version = dict_values['version']
25
            self.url = dict_values['url']
26
            self.mail = dict_values['mail']
27
            self.goal = dict_values['goal']
28
            self.deploy_repository = dict_values['deploy_repository']
29
            self.deploy_repository_url = dict_values['deploy_repository_url']
30
            if 'cron' in dict_values:
31
                self.cron = dict_values['cron']
32

    
33

    
34
if os.path.isdir('/tmp/DSL40'):
35
    shutil.rmtree('/tmp/DSL40')
36
    print "DELETED Folder"
37
os.makedirs('/tmp/DSL40')
38
client = pysvn.Client()
39

    
40
entry_list = client.ls("http://svn-public.driver.research-infrastructures.eu/driver/dnet40/build/")
41
entry_module_list = client.ls("http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/")
42
entry_list = entry_list+ entry_module_list
43
data_list =[]
44
renderer = pystache.Renderer()
45

    
46
f = open("/tmp/DSL40/configuration.xml", "w")
47
f.write('<?xml version="1.0"?>')
48
f.write("\n")
49
f.write("<modules>")
50
f.write("\n")
51

    
52
for e in entry_list:
53
    name = e.name
54
    try:
55
        data =json.loads(client.cat(e.name + "/trunk/deploy.info"))
56
        data_list.append(data)
57
        d = DeployModule(dict_values=data)
58
        f.write(renderer.render(d))
59
        f.write("\n")
60
    except Exception as e:
61
        print "NOT FOUND IN %s "% (name.split('/')[-1])
62
        print e
63

    
64
f.write("\n")
65
f.write("</modules>")
66
f.close()
(1-1/4)