예제 #1
0

def init_environment(use_fife):
    """Sets up everything. Use in any program that requires access to FIFE and uh modules.
	It will parse sys.args, so this var has to contain only valid uh options."""

    # install dummy translation
    gettext.install('', unicode=True)
    if use_fife:
        setup_fife()


def log_paths():
    """Prints debug info about paths to log"""
    log().debug("SYS.PATH: %s", sys.path)
    log().debug('PATHSEP: "%s" SEP: "%s"', os.path.pathsep, os.path.sep)
    log().debug("LD_LIBRARY_PATH: %s",
                os.environ.get('LD_LIBRARY_PATH', '<undefined>'))
    log().debug("PATH: %s", os.environ.get('PATH', '<undefined>'))
    log().debug("PYTHONPATH %s", os.environ.get('PYTHONPATH', '<undefined>'))


def log_sys_info():
    """Prints debug info about the current system to log"""
    log().debug("Python version: %s", sys.version_info)
    log().debug("Platform: %s", platform.platform())


if __name__ == '__main__':
    main()
예제 #2
0
	# WORKAROUND: windows systems don't handle spaces in arguments for execvp correctly.
	if platform.system() != 'Windows':
		if logfilename:
			args += [ "--logfile", logfilename ]
		log().debug("Restarting with args %s", args)
		os.execvp(args[0], args)
	else:
		args[1] = "\"%s\"" % args[1]
		args += [ "--logfile", "\"%s\"" % logfilename ]
		log().debug("Restarting using windows workaround with args %s", args)
		os.system(" ".join(args))
		sys.exit(0)

def log_paths():
	"""Prints debug info about paths to log"""
	log().debug("SYS.PATH: %s", sys.path)
	log().debug("PATHSEP: \"%s\" SEP: \"%s\"", os.path.pathsep, os.path.sep)
	log().debug("LD_LIBRARY_PATH: %s", os.environ['LD_LIBRARY_PATH'])
	log().debug("PATH: %s", os.environ['PATH'])
	log().debug("PYTHONPATH %s", os.environ.get('PYTHONPATH', '<undefined>'))

def log_sys_info():
	"""Prints debug info about the current system to log"""
	log().debug("Python version: %s", sys.version_info)
	log().debug("Plattform: %s", platform.platform())


if __name__ == '__main__':
	main()