def getCurrentAccount(self):
		address = config.get("account.current", None)

		if address is None:
			address = User.getUsers(self.getDataDirectory())[0]
			config.set("account.current", address)

		return address
	def actionConfigSet(self, name, value):
		"""
			Set config value

			Usage:
			config set <name> <value>   Set config variable <name> to <value>. <name> can be dot-separated.
		"""

		config.set(name, value)
	def actionAccountChoose(self, address):
		"""
			Choose account for actions

			Usage:
			account choose <address>    Use <address> account for all actions
		"""

		try:
			User.getUser(self.getDataDirectory(), address)
		except KeyError:
			sys.stderr.write("No account %s\n" % address)
			return 1

		config.set("account.current", address)
예제 #4
0
        Repo.clone_from(moduleInfo['package'], "modules/" + str(moduleInfo['name']))  # Install the module from git
    except:
        print "Error cloning " + str(moduleInfo['name'])
    module = str(moduleInfo['name'])

    """ Import config for the module if it exists """
    if moduleInfo['config']:
        configSplit = moduleInfo['config'].split("\r\n")
	print configSplit
        try:
            config.add_section(module)
        except:
            pass
	for configLine in configSplit:
		configSplitNow = configLine.split("=")
	        config.set(module, str(configSplitNow[0]).strip(), configSplitNow[1])

    """ Write out an ID to the module folder for it's own setup to use """
    target = open("modules/" + module + "/id.txt", 'w')
    target.write(str(moduleID))
    target.close()

    """ Exec the module's own setup file """
    script = os.path.join(root, module, "setup.py")
    if os.path.isfile(script):
        g = globals().copy()
        g['__file__'] = script
        execfile(script, g)

    """ Remove from "to be removed" list """
    try:
예제 #5
0
def test_create_config():
    config.set("test", "test2", "testingconfig2")
    assert config.get("test", "test2") == "testingconfig2"