1
2
3
4
5 """
6
7 freshmeat
8 =========
9
10 Currently this plugin uses http://doapspace.org/ to fetch DOAP for Freshmeat
11
12
13 """
14
15 __docformat__ = 'epytext'
16
17
18 from doapfiend.utils import NotFoundError
19 from doapfiend.plugins.base import Plugin
20 from doapfiend.plugins.pkg_index import get_by_pkg_index
21
22
24
25 """Get DOAP from Freshmeat package index"""
26
27
28 name = "fm"
29 enabled = False
30 enable_opt = name
31
33 '''Setup RDF/XML OutputPlugin class'''
34 super(FreshmeatPlugin, self).__init__()
35 self.options = None
36 self.query = None
37
39 """Add plugin's options to doapfiend's opt parser"""
40 search.add_option('--%s' % self.name,
41 action='store',
42 dest=self.enable_opt,
43 help='Get DOAP by its Freshmeat project name.',
44 metavar='PROJECT_NAME')
45 return parser, output, search
46
48 '''
49 Get Freshmeat DOAP
50
51 @param proxy: URL of optional HTTP proxy
52 @type proxy: string
53
54 @rtype: unicode
55 @returns: Single DOAP
56
57 '''
58 if hasattr(self.options, self.name):
59 self.query = getattr(self.options, self.name)
60
61 try:
62 return get_by_pkg_index(self.name, self.query, proxy)
63 except NotFoundError:
64 print "Not found: %s" % self.query
65