50
50
if __name__ == "__main__":
52
parser = OptionParser("usage: %prog [options] [package-name | apturl | deb-file]",
53
version="%prog "+VERSION)
52
parser = OptionParser("usage: %prog [options] [package-name | apturl | "
53
"deb-file]", version="%prog " + VERSION)
54
54
parser.add_option("--debug", action="store_true",
55
55
help="enable debug mode", default=False)
56
parser.add_option("--debug-filter",
56
parser.add_option("--debug-filter",
57
57
help="show only specific messages. supported currently: "
58
58
"'softwarecenter.performance'")
59
59
parser.add_option("--force-rtl", action="store_true",
60
help="force rtl mode (useful for debugging)",
60
help="force rtl mode (useful for debugging)",
62
62
parser.add_option("--display-navlog", action="store_true",
63
help="display a navigation history log (useful for debugging)",
65
# FIXME: REMOVE THIS option once launchpad integration is enabled
67
parser.add_option("--enable-lp", action="store_true",
68
help="enable launchpad integration (for development use)",
63
help="display a navigation history log (useful for "
64
"debugging)", default=False)
70
65
parser.add_option("--disable-buy", action="store_true",
71
66
help="disable support to buy software",
73
68
parser.add_option("--disable-apt-xapian-index", action="store_true",
74
help="disable support for apt-xapian-index (technical items)",
69
help="disable support for apt-xapian-index (technical "
70
"items)", default=False)
76
71
parser.add_option("--measure-startup-time", action="store_true",
77
help="open and wait until the window is visible, then close, only useful for profiling",
72
help="open and wait until the window is visible, "
73
"then close, only useful for profiling", default=False)
79
74
parser.add_option("--dummy-backend", action="store_true",
80
help="run with a dummy backend, this will not actually install or remove anything and is useful for testing",
75
help="run with a dummy backend, this will not actually "
76
"install or remove anything and is useful for testing",
82
78
parser.add_option("--packagekit-backend", action="store_true",
83
help="use PackageKit backend (experimental)",
79
help="use PackageKit backend (experimental)",
85
81
parser.add_option("--profile", action="store_true",
86
82
help="use cProfile to gather a profile dump for e.g. "
87
"kcachegrind, runsnake, gprof2dot",
83
"kcachegrind, runsnake, gprof2dot",
90
86
(options, args) = parser.parse_args()
120
118
Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)
122
120
# check if running locally
123
(datadir, xapian_base_path) = mangle_paths_if_running_in_local_checkout()
121
mangle_paths_if_running_in_local_checkout()
125
123
# ensure we can actually run
126
124
Gtk.init_check(sys.argv)
128
# set default ssl-ca-file here because it needs only be set once, but
129
# it can not be set in the global context as this will cause segfaults
130
# on exit. However its IMPORTANT to set it as libsoup is *not* secure
131
# by default (see bugzilla #666280 and #666276)
132
from gi.repository import WebKit as webkit
133
# enable certificates validation in webkit views unless specified otherwise
134
if not "SOFTWARE_CENTER_FORCE_DISABLE_CERTS_CHECK" in os.environ:
135
session = webkit.get_default_session()
136
session.set_property("ssl-ca-file", "/etc/ssl/certs/ca-certificates.crt")
138
# WARN the user!! Do not remove this
139
LOG.warning("SOFTWARE_CENTER_FORCE_DISABLE_CERTS_CHECK " +
140
"has been specified, all purchase transactions " +
141
"are now INSECURE and UNENCRYPTED!!")
144
from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
127
with ExecutionTime("import SoftwareCenterApp"):
128
from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
145
129
with ExecutionTime("create SoftwareCenterApp"):
146
app = SoftwareCenterAppGtk3(datadir, xapian_base_path, options, args)
130
app = SoftwareCenterAppGtk3(options, args)
149
133
if options.measure_startup_time:
150
134
logger = logging.getLogger("softwarecenter.performance")
151
135
with ExecutionTime("show() & gtk events until visible"):