3 # (name, CM, protocol, icon)
5 ('Jabber', 'gabble', 'jabber', 'jabber'),
9 def __init__(self, name, cm, protocol, icon):
12 self.protocol = protocol
15 ##### The plugin itself #####
17 def generate_build_block(p):
18 la = 'lib%s_la' % p.protocol.replace('-', '_')
20 output = '''%s_SOURCES = \\
21 empathy-accounts-plugin.c \\
22 empathy-accounts-plugin.h \\
23 empathy-accounts-plugin-widget.c \\
24 empathy-accounts-plugin-widget.h
25 %s_LDFLAGS = -module -avoid-version
28 $(top_builddir)/libempathy-gtk/libempathy-gtk.la
33 def generate_makefile_am(plugins):
34 '''Generate Makefile.am'''
39 name = ' lib%s.la' % p.protocol
42 build_blocks.append(generate_build_block(p))
44 f = open('Makefile.am', 'w')
47 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
48 # Do NOT edit manually
49 SUBDIRS = providers services
51 plugindir = $(ACCOUNTS_PROVIDER_PLUGIN_DIR)
56 -DLOCALEDIR=\\""$(datadir)/locale"\\" \\
60 $(DISABLE_DEPRECATED) \\
63 plugin_LTLIBRARIES = \\
67 %s''' % ('\\\n'.join(libs), '\n\n'.join(build_blocks)))
71 def generate_provider_file(p):
72 f = open('providers/%s.provider' % p.protocol, 'w')
75 '''<?xml version="1.0" encoding="UTF-8" ?>
76 <!-- Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
77 Do NOT edit manually -->
82 ''' % (p.protocol, p.name, p.icon))
84 def generate_providers(plugins):
85 '''generate providers/*.provider files and providers/Makefile.am'''
89 providers.append(' %s.provider' % p.protocol)
91 generate_provider_file(p)
93 # providers/Makefile.am
94 f = open('providers/Makefile.am', 'w')
96 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
97 # Do NOT edit manually
98 providersdir = $(ACCOUNTS_PROVIDER_FILES_DIR)
104 EXTRA_DIST = $(providers_DATA)
105 ''' % ('\\\n'.join(providers)))
109 def generate_service_file(p):
110 f = open('services/%s-im.service' % p.protocol, 'w')
113 '''<?xml version="1.0" encoding="UTF-8" ?>
114 <!-- Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
115 Do NOT edit manually -->
120 <provider>%s</provider>
122 <!-- default settings (account settings have precedence over these) -->
124 <group name="telepathy">
125 <setting name="manager">%s</setting>
126 <setting name="protocol">%s</setting>
131 ''' % (p.protocol, p.name, p.icon, p.protocol, p.cm, p.protocol))
133 def generate_services(plugins):
134 '''generate services/*-im.service files and services/Makefile.am'''
138 services.append(' %s-im.service' % p.protocol)
140 generate_service_file(p)
142 # providers/Makefile.am
143 f = open('services/Makefile.am', 'w')
145 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
146 # Do NOT edit manually
147 servicesdir = $(ACCOUNTS_SERVICE_FILES_DIR)
153 EXTRA_DIST = $(services_DATA)
154 ''' % ('\\\n'.join(services)))
159 for name, cm, protocol, icon in ALL:
160 plugins.append(Plugin(name, cm, protocol, icon))
162 generate_makefile_am(plugins)
163 generate_providers(plugins)
164 generate_services(plugins)
166 if __name__ == '__main__':