def galacteekGui(args): progName = args.binaryname if args.binaryname else sys.argv[0] gc.enable() if inPyInstaller(): folder = pyInstallerBundleFolder() binPath = folder.joinpath('bin') os.environ['PATH'] = str(binPath) + os.pathsep + os.environ['PATH'] os.chdir(str(folder)) if args.mallocdebug: tracemalloc.start() if args.debug: faulthandler.enable() # QtWebEngine init QtWebEngine.initialize() # Initialize webengine schemes before creating the application initializeSchemes() gApp = application.GalacteekApplication( profile=args.profile, debug=args.debug, enableOrbital=args.enableorbital, sslverify=False if args.nosslverify else True, progName=progName, cmdArgs=args) level = 'DEBUG' if args.debug else 'INFO' if args.logstderr: glogger.basicConfig(level=level, colorized=args.logcolorized, loop=gApp.loop) else: glogger.basicConfig(outputFile=gApp.mainLogFileLocation, level=level, colorized=args.logcolorized, loop=gApp.loop) if not gApp.acquireLock(): gApp.onExit() return gApp.configure() # Monitor event loop if aiomonitor is available # Use the context manager so loop cleanup/close is automatic loop = gApp.loop if args.monitor is True and haveAiomonitor: with aiomonitor.start_monitor(loop=loop): with loop: loop.run_forever() else: with loop: loop.run_forever()
def makeAppNoDaemon(): cmdArgs = parser.parse_args([]) gApp = application.GalacteekApplication(profile='pytest-noipfsd', debug=True, cmdArgs=cmdArgs) sManager = gApp.settingsMgr sManager.setFalse(CFG_SECTION_IPFSD, CFG_KEY_ENABLED) sManager.sync() gApp.updateIpfsClient() return gApp
def makeApp(profile='pytest-withipfsd'): cmdArgs = parser.parse_args([]) r = random.Random() gApp = application.GalacteekApplication(profile=profile, cmdArgs=cmdArgs) gApp.configure() sManager = gApp.settingsMgr sManager.setTrue(CFG_SECTION_IPFSD, CFG_KEY_ENABLED) sManager.setSetting(CFG_SECTION_IPFSD, CFG_KEY_APIPORT, r.randint(15500, 15580)) sManager.setSetting(CFG_SECTION_IPFSD, CFG_KEY_SWARMPORT, r.randint(15600, 15680)) sManager.setSetting(CFG_SECTION_IPFSD, CFG_KEY_HTTPGWPORT, r.randint(15700, 15780)) sManager.sync() return gApp
from galacteek.core import glogger from galacteek.config import initFromTable from galacteek.config import cSetSavePath from galacteek.ipfs.ipfsops import IPFSOperator from galacteek.ipfs.ipfsops import IPFSOpRegistry from galacteek.ipfs import asyncipfsd from galacteek.guientrypoint import buildArgsParser from galacteek import application from galacteek.appsettings import * from . import mockipfsctx parser = buildArgsParser() glogger.basicConfig(level='DEBUG') qGlobalApp = application.GalacteekApplication(profile='pytest-galacteek-app', cmdArgs=parser.parse_args([])) @pytest.fixture def dbpath(tmpdir): return tmpdir.join('db.sqlite3') @pytest.fixture def configpath(tmpdir): return str(tmpdir.join('g-config-0')) @pytest.fixture def gConfigInit(configpath): cSetSavePath(Path(configpath))