~roadmr/ubuntu/precise/checkbox/0.13.1

« back to all changes in this revision

Viewing changes to checkbox/application.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Tardif, Gabor Keleman
  • Date: 2009-08-19 15:36:05 UTC
  • Revision ID: james.westby@ubuntu.com-20090819153605-weo6htup3yi6zn0t
Tags: 0.8~alpha4
* New upstream version:
  * Changed icon.
  * Added timeout property to lock_prompt plugin.
  * Added concept of attachments to tests.
  * Added support for backslahes in templates to wrap lines.
  * Added support blacklisting and whitelisting both tests and suites.
  * Introduced the concept of jobs for suites, tests and attachments.
  * Removed upstart event which is no longer needed.
  * Replaced architecture and category with requires in test definitions.
* Fixed pygst dependency (LP: #334442)
* Fixed configuration file updates during install (LP: #330596)
* Fixed and expanded translations (LP: #347038)
* Fixed ignored system proxy settings (LP: #345548)
* Fixed parsing blank lines in templates (LP: #393907)
* Fixed escaping of lists (LP: #394001)
* Fixed timeout in manual tests (LP: #377986)
* Fixed CLI interface dialog.
* Fixed support for FreeDesktop XDG base directory specification (LP: #363549)
* Added general and package specific apport hooks

[ Gabor Keleman ]
* Fixed untranslated strings in tests (LP: #374666)
* Fixed untranslated last screen (LP: #374646)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
from checkbox.lib.config import Config
31
31
from checkbox.lib.environ import get_variable
 
32
from checkbox.lib.safe import safe_make_directory
 
33
from checkbox.lib.text import split
32
34
 
33
35
from checkbox.plugin import PluginManager
34
36
from checkbox.reactor import Reactor
35
37
from checkbox.registry import RegistryManager
36
38
 
37
39
 
38
 
def parse_string(options):
39
 
    args = []
40
 
    while True:
41
 
        options = options.strip()
42
 
        if not options:
43
 
            break
44
 
 
45
 
        index = 0
46
 
        while index < len(options) \
47
 
              and (not options[index].isspace() \
48
 
                  or options[index - 1] == "\\"):
49
 
           index += 1
50
 
 
51
 
        args.append(options[:index])
52
 
        options = options[index:]
53
 
 
54
 
    return args
55
 
 
56
 
 
57
40
class Application(object):
58
41
 
59
42
    reactor_factory = Reactor
105
88
        return parser.parse_args(args)
106
89
 
107
90
    def create_application(self, args=sys.argv):
 
91
        # Create data directory
 
92
        data_directory = get_variable("CHECKBOX_DATA", ".")
 
93
        safe_make_directory(data_directory)
 
94
 
108
95
        # Prepend environment options
109
96
        string_options = get_variable("CHECKBOX_OPTIONS", "")
110
 
        args[:0] = parse_string(string_options)
 
97
        args[:0] = split(string_options)
111
98
        (options, args) = self.parse_options(args)
112
99
 
113
100
        log_level = logging.getLevelName(options.log_level.upper())
134
121
            sys.stderr.write(_("Missing configuration file as argument.\n"))
135
122
            sys.exit(1)
136
123
 
137
 
        config_file = posixpath.expanduser(args[1])
138
 
        config = Config(config_file, options.config)
 
124
        config = Config()
 
125
        config_filename = posixpath.expanduser(args[1])
 
126
        config.read_filename(config_filename)
 
127
        config.read_configs(options.config)
139
128
 
140
129
        section_name = "checkbox/plugins/client_info"
141
130
        section = config.get_section(section_name)
142
131
        if not section:
143
132
            section = config.add_section(section_name)
144
 
        section.set("name", posixpath.basename(config.path) \
 
133
        section.set("name", posixpath.basename(args[1]) \
145
134
            .replace(".ini", ""))
146
135
        section.set("version", config.get_defaults().version)
147
136