2 Holds information about what the user asked for (which program, version constraints, etc).
5 # Copyright (C) 2011, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
8 class Requirements(object):
10 Holds information about what the user asked for (which program, version constraints, etc).
16 'before', 'not_before',
21 def __init__(self
, interface_uri
):
22 self
.interface_uri
= interface_uri
25 self
.before
= self
.not_before
= None
26 self
.os
= self
.cpu
= None
29 def parse_options(self
, options
):
30 self
.not_before
= options
.not_before
31 self
.before
= options
.before
33 self
.source
= bool(options
.source
)
34 self
.message
= options
.message
36 self
.cpu
= options
.cpu
39 # (None becomes 'run', while '' becomes None)
40 if options
.command
is None:
42 self
.command
= 'compile'
46 self
.command
= options
.command
or None
48 def get_as_options(self
):
51 gui_args
.insert(0, self
.not_before
)
52 gui_args
.insert(0, '--not-before')
54 gui_args
.insert(0, self
.before
)
55 gui_args
.insert(0, '--before')
57 gui_args
.insert(0, '--source')
59 gui_args
.insert(0, self
.message
)
60 gui_args
.insert(0, '--message')
62 gui_args
.insert(0, self
.cpu
)
63 gui_args
.insert(0, '--cpu')
65 gui_args
.insert(0, self
.os
)
66 gui_args
.insert(0, '--os')
67 gui_args
.append('--command')
68 gui_args
.append(self
.command
or '')