File: source_eclipse.py

package info (click to toggle)
eclipse 3.8.0~rc4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 338,668 kB
  • sloc: java: 2,766,594; ansic: 136,762; xml: 104,394; cpp: 35,759; jsp: 4,420; sh: 3,288; perl: 1,687; makefile: 186; python: 67; php: 24
file content (31 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download | duplicates (3)
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
'''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")