File: source_eclipse.py

package info (click to toggle)
eclipse 3.5.2-6squeeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 297,208 kB
  • ctags: 426,326
  • sloc: java: 2,527,099; ansic: 122,607; xml: 100,868; cpp: 33,545; jsp: 3,869; sh: 2,557; perl: 1,650; makefile: 272; csh: 151; python: 69; php: 24
file content (34 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''Apport package hook for Eclipse

Copyright 2010 Benjamin Drung <bdrung@ubuntu.com>
License: EPL-1.0 | GPL-2+
'''

import apport.hookutils
import glob
import os

def add_info(report):
	apport.hookutils.attach_conffiles(report, "eclipse-platform")

	# Guess workspace if we fail to detect it
	workspace = "~/workspace"

	# try to detect the workspace directory
	preffile_pattern = "~/.eclipse/org.eclipse.platform_*/configuration/.settings/org.eclipse.ui.ide.prefs"
	for preffile in glob.glob(os.path.expanduser(preffile_pattern)):
		lines = open(preffile).readlines()
		lines = filter(lambda l: l.startswith("RECENT_WORKSPACES="), lines)
		if len(lines) > 0:
			workspaces = lines[0].split("=")[1]
			# workspaces are separated by "\n" - we take the first item
			workspace = workspaces.split("\\n")[0]

	# workspace/.metadata/.log
	logfile = os.path.join(workspace, ".metadata", ".log")
	apport.hookutils.attach_file_if_exists(report, logfile, "workspace.metadata.log")

	# list of xulrunner libraries
	xulrunner_list = glob.glob("/usr/lib/xulrunner-[0-9]*")
	xulrunner_list.sort()
	report["xulrunner-versions"] = "\n".join(xulrunner_list)