def main(): app="gnome-app-install" gettext.textdomain(app) gettext.bindtextdomain(app) parser = OptionParser() parser.add_option("", "--mime-type", default=None, action="store", type="string", dest="mime_type", help="Show only applications that handle the given " "file type") parser.add_option("", "--transient-for", default=None, action="store", type="int", dest="transient_for", help="Start as a child window of the given window (Only " "needed by developers") parser.add_option("", "--data-dir", default="/usr/share/gnome-app-install", action="store", type="string", dest="datadir", help="Load data from the given directory (Only needed " "by developers)") parser.add_option("", "--desktopdir", default="/usr/share/app-install", action="store", type="string", dest="desktopdir", help="Read the desktop files from the given directory " "(Only needed by developers)") parser.add_option("", "--cachedir", default="/var/cache/app-install", action="store", type="string", dest="cachedir", help="Use the given directory for the cache (Only " "needed by developers)") parser.add_option("", "--xul-extensions", default=None, action="store", type="string", dest="xul_extensions", help="Start as installer for XUL extensions") parser.add_option("", "--addon-cd", default=None, action="store", type="string", dest="addon_cd", help="Start as installer for an addon cd") parser.add_option("", "--selftest", action="store_true", dest="selftest", help="Perform self tests (Only needed " "by developers)") parser.add_option("", "--profile", action="store", type="string", dest="profile", default=None, help="Store profiling data in the given file " "(Only needed by developers)") parser.add_option("", "--test-mode", action="store_true", dest="test_mode", help="Run in a sepcial test mode" "(Only needed by developers)") (options, args) = parser.parse_args() if options.selftest: from AppInstall import AppInstall app = AppInstall(options, ActivationStyle()) while True: model = app.treeview_packages.get_model() it = model.get_iter_root() (name, item, popcon) = model[it] app.applyChanges([item], []) # activation style if sys.argv[0].split("/")[-1] == "gstreamer-codec-install": style = CodecSearchActivationStyle(options, args) elif options.mime_type: #FIXME: What is an uri, duri? uri = None duri = None if len(args) > 1: uri = args[0] duri = args[1] elif len(args) > 0: uri = args[0] duri = uri style = MimeSearchActivationStyle(options, uri, duri) elif options.xul_extensions: style = XULExtensionsActivationStyle(options) else: style = ActivationStyle() if style.preRun(): # We have already bombed out if the quick test fails. We do this # import only now so that quick tests are really quick. from AppInstall import AppInstall #FIXME: could be easily made simpler, talk with aptoncd author # before any api changes app = AppInstall(options, style) if options.profile: import hotshot prof = hotshot.Profile(options.profile) print prof.runcall(app.run) prof.close() else: app.run()
def __getLatestBuildNumber(self): if 'buildNum' in self.parameter and self.parameter['buildNum'] != None: self.buildNum = self.parameter['buildNum'] else: import AppInstall task = AppInstall.childTask('appInstall') task.addPara('appName', 'Photoshop') task.addPara('appVer', self.parameter['ProductVersion']) task.addPara('appSubProduct', 'Application') self.buildNum = task._getInstalledBuildNum() if self.buildNum!="" and self.buildNum!=None: pass elif 'molecule' in self.parameter: moleculeReStr = "\d{8}\." + self.parameter['molecule'] + "\.\d{1,}" from CodexTask import childTask task = childTask('codexTask') self.buildNum = "unknown" builds = task.getBuilds( 'Photoshop', self.parameter['ProductVersion'], "Molecule", "Release", #CompileTarget self.platform, globalProperty.getSysInfo().locale, 'Build Failed') if builds==None: return None latestBuildLocation = None for build in builds: if re.match(moleculeReStr, build._build): latestBuildLocation = build._location['protocol'] + "://" + \ build._location['server'] + \ build._location['path'] self.buildNum = build._build break else: if globalProperty.isMachineOutOfChina(): #Support the machine out of China, will download directly import CodexTask task = CodexTask.childTask('codexTask') latestBuild = task.getBuild( 'Photoshop', self.parameter['ProductVersion'], "Release", #CompileTarget self.platform, globalProperty.getSysInfo().locale, 'Build Failed') if latestBuild==None: return None self.buildNum = latestBuild._build else: self.buildNum = globalProperty.getLatestBuildNum('Photoshop', self.parameter['ProductVersion'], self.platform, globalProperty.getSysInfo().locale, 'Build Failed', 'Application')