예제 #1
0
 def select_executable(self):
     self.executable = yield select_executable()
     logging.debug("Selected executable: %s", self.executable)
     if not self.executable:
         logging.critical("Tahoe-LAFS not found")
         msg.critical(
             "Tahoe-LAFS not found",
             "Could not find a suitable 'tahoe' executable in your PATH. "
             "Please install Tahoe-LAFS version 1.13.0 or greater and try "
             "again.")
         reactor.stop()
예제 #2
0
파일: cli.py 프로젝트: joppich/gridsync
def main():
    parser = argparse.ArgumentParser(
        description=description)
    parser.add_argument(
        '--debug',
        action='store_true',
        help='Print debug messages to STDOUT.')
    parser.add_argument(
        '--tahoe-version',
        nargs=0,
        action=TahoeVersion,
        help="Call 'tahoe --version-and-path' and exit. For debugging.")
    parser.add_argument(
        '-V',
        '--version',
        action="version",
        version='%(prog)s ' + __version__)
    args = parser.parse_args()

    if args.debug:
        logging.basicConfig(
            format='%(asctime)s %(levelname)s %(funcName)s %(message)s',
            level=logging.DEBUG, stream=sys.stdout)
        from twisted.python.log import startLogging
        startLogging(sys.stdout)
    #else:
    #    appname = settings['application']['name']
    #    logfile = os.path.join(config_dir, '{}.log'.format(appname))
    #    logging.basicConfig(
    #        format='%(asctime)s %(levelname)s %(funcName)s %(message)s',
    #        level=logging.INFO, filename=logfile)

    try:
        core = Core(args)
        core.start()
    except FilesystemLockError:
        msg.critical(
            "{} already running".format(APP_NAME),
            "{} is already running.".format(APP_NAME))
        return 1
    return 0
예제 #3
0
 def start_gateways(self):
     nodedirs = get_nodedirs(config_dir)
     if nodedirs:
         minimize_preference = get_preference("startup", "minimize")
         if not minimize_preference or minimize_preference == "false":
             self.gui.show_main_window()
         yield self.select_executable()
         tor_available = yield get_tor(reactor)
         logging.debug("Starting Tahoe-LAFS gateway(s)...")
         for nodedir in nodedirs:
             gateway = Tahoe(nodedir, executable=self.executable)
             tcp = gateway.config_get("connections", "tcp")
             if tcp == "tor" and not tor_available:
                 logging.error("No running tor daemon found")
                 msg.error(
                     self.gui.main_window,
                     "Error Connecting To Tor Daemon",
                     'The "{}" connection is configured to use Tor, '
                     "however, no running tor daemon was found.\n\n"
                     "This connection will be disabled until you launch "
                     "Tor again.".format(gateway.name),
                 )
             self.gateways.append(gateway)
             d = gateway.start()
             d.addCallback(gateway.ensure_folder_links)
         self.gui.populate(self.gateways)
     else:
         self.gui.show_welcome_dialog()
         yield self.select_executable()
     try:
         yield self.get_tahoe_version()
     except Exception as e:  # pylint: disable=broad-except
         logging.critical("Error getting Tahoe-LAFS version")
         msg.critical(
             "Error getting Tahoe-LAFS version",
             "{}: {}".format(type(e).__name__, str(e)),
         )
         reactor.stop()
예제 #4
0
def main():
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument(
        "--debug", action="store_true", help="Print debug messages to STDOUT."
    )
    parser.add_argument(
        "--tahoe-version",
        nargs=0,
        action=TahoeVersion,
        help="Call 'tahoe --version-and-path' and exit. For debugging.",
    )
    parser.add_argument(
        "-V", "--version", action="version", version="%(prog)s " + __version__
    )

    try:
        Core(parser.parse_args()).start()
    except FilesystemLockError:
        msg.critical(
            "{} already running".format(APP_NAME),
            "{} is already running.".format(APP_NAME),
        )
        return "ERROR: {} is already running.".format(APP_NAME)
    return 0