Ejemplo n.º 1
0
def main():
    """Handle Commands"""
    try:
        args = get_args()
        if args.mode == "install":
            install.validate(args)
            install.run(args)
        elif args.mode == "storage-add":
            storage_add.validate(args)
            storage_add.run(args)
        elif args.mode == "storage-list":
            storage_list.validate(args)
            storage_list.run(args)
        elif args.mode == "version":
            show_version()
    except KeyboardInterrupt:
        return
Ejemplo n.º 2
0
def run():
    input = sys.argv[1]
    if input in ['new']:
        from install import run
        run(*sys.argv)
    elif input in ['deploy']:
        from deploy_run import run
        run(*sys.argv)
    elif input in ['routes']:
        finder = ''
        if len(sys.argv) == 3:
            finder = sys.argv[2]

        os.system(f"pipenv run python3 routes.py {finder}")
    elif input in ['run', 'serve', 'server', 's']:
        options = ' '.join(sys.argv[2:])
        os.system(f"pipenv run flask run {options}")
def launch(sysTrayIcon=None):
    base = os.path.join(os.getenv('LOCALAPPDATA'), 'Open Media Library')
    pid = os.path.join(base, 'data', 'openmedialibrary.pid')
    python = os.path.join(base, 'platform_win32', 'pythonw.exe')
    oml = os.path.join(base, 'openmedialibrary')
    if check_pid(pid):
        webbrowser.open_new_tab(
            os.path.join(base, 'openmedialibrary', 'static', 'html',
                         'load.html'))
        #sysTrayIcon._check = Check(sysTrayIcon, pid)
    elif os.path.exists(python) and os.path.exists(oml):
        subprocess.Popen([python, 'oml', 'server', pid],
                         cwd=oml,
                         start_new_session=True)
        webbrowser.open_new_tab(
            os.path.join(base, 'openmedialibrary', 'static', 'html',
                         'load.html'))
        #sysTrayIcon._check = Check(sysTrayIcon, pid)
    else:
        install.run(base)
Ejemplo n.º 4
0
def main():    
     # do some preliminary stuff
    GameZero.MY_FULLNAME = os.path.normpath(os.path.abspath(__file__))
    GameZero.MY_NAME = os.path.split(os.path.dirname(GameZero.MY_FULLNAME))[1]
    GameZero.PROG_DIR = os.path.dirname(GameZero.MY_FULLNAME)
    GameZero.DATABASE_PATH = os.path.join(GameZero.PROG_DIR, GameZero.MY_NAME, "DATABASE.DB")
    
    # Make sure we can write to the data dir
    if not os.access(GameZero.PROG_DIR, os.W_OK):
        sys.exit("Data directory: " + GameZero.PROG_DIR + " must be writable (write permissions). Exiting.") 
    
    #CANT FIND DATABASE - RUN INSTALL    
    if not os.path.exists(GameZero.DATABASE_PATH):
        install.run(GameZero.DATABASE_PATH)#run the install
            
    #Load the configs
    db.LogMessage(GameZero.DATABASE_PATH, "Loading Configurations to memory", "Info")
    LoadConfigs(db.config(GameZero.DATABASE_PATH))
        
    #get cherrypy ready
    db.LogMessage(GameZero.DATABASE_PATH, "Registering Background Processes", "Info")
    
    GameZero.THEMEPATH = os.path.join(GameZero.PROG_DIR, GameZero.MY_NAME,"resources","interface",GameZero.THEME)
        
    cherrypy.config.update({'server.socket_port': int(GameZero.SERVERPORT), 'server.socket_host': GameZero.HOST, 'response.timeout':900})
    appConfig = {'/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': GameZero.THEMEPATH}}
    cherrypy.tree.mount(site.site(), '/', appConfig)
      
    Monitor(cherrypy.engine, tasks.Task().CheckUpdates, frequency=86400).subscribe()
    Monitor(cherrypy.engine, tasks.Task().PostProcess, frequency=86400).subscribe()
    #Monitor(cherrypy.engine, Task.Task().PostProcess, frequency=86400).subscribe()
    
    db.LogMessage(GameZero.DATABASE_PATH, "Starting Service", "Info")
    cherrypy.engine.start()
 
    if(GameZero.BROWSER == '1'):
        webbrowser.open("http://" + cherrypy.server.socket_host + ":" + str(cherrypy.server.socket_port) + '/')
    
    cherrypy.engine.block()
Ejemplo n.º 5
0
	archive.close()

	# Stop Python adding .pyc files
	for root, dirs, files in os.walk(os.path.join(tmp, 'zeroinstall')):
		os.chmod(root, 0500)

	sys.path.insert(0, tmp)
	sys.argv[0] = os.path.join(tmp, 'install.py')

	print "Installing..."
	import install
	installer = install.Installer()
	toplevel_uris = installer.do_install(self_stream, progress_bar, archive_offset)
	self_stream.close()

	if w:
		w.finish_install()
finally:
	print "Removing temporary files..."
	for root, dirs, files in os.walk(os.path.join(tmp, 'zeroinstall')):
		os.chmod(root, 0700)
	shutil.rmtree(tmp)

if w is None or w.run_option.get_active():
	print "Running..."
	install.run(toplevel_uris[0], not INSTALLER_MODE and ['--offline'] or [], args)
elif INSTALLER_MODE:
	print "Downloading..."
	assert not args, "Download only mode, but arguments given: %s" % args
	install.run(toplevel_uris[0], ['--download-only'])
Ejemplo n.º 6
0
import pathlib
import shutil
import config
import subprocess
import install

install.run()
subprocess.call('npm run build', shell=True)

vars = config.Variable()
my_file = pathlib.Path("{}/install/cv.pdf".format(vars.pwd))
to_file = pathlib.Path("{}/resume_{}.pdf".format(
    vars.build_folder, "Pierre-Alexis_Blond"))
shutil.copy(str(my_file), str(to_file))
            for line in manifest:
                if line.strip() != '' and not line.startswith('#'):
                    live_packages.add(line.split()[0])
            manifest.close()
            difference = live_packages - desktop_packages
        else:
            difference = set()

        # Keep packages we explicitly installed.
        difference -= self.query_recorded_installed()

        if len(difference) == 0:
            return

        # Don't worry about failures removing packages; it will be easier
        # for the user to sort them out with a graphical package manager (or
        # whatever) after installation than it will be to try to deal with
        # them automatically here.
        self.do_remove(difference)

if __name__ == '__main__':
    if not os.path.exists('/var/lib/ubiquity'):
        os.makedirs('/var/lib/ubiquity')
    if os.path.exists('/var/lib/ubiquity/install.trace'):
        os.unlink('/var/lib/ubiquity/install.trace')

    install = Install()
    sys.excepthook = install.excepthook
    install.run()
    sys.exit(0)
Ejemplo n.º 8
0
def handler(request):
    import install
    install.run(request)
Ejemplo n.º 9
0
def start(install_image=None):
    desktop = gui.DesktopWindow(gui.getScreen().get_size(), gui.res.background)
    gui.setDesktop(desktop)

    global header, marquee
    header = Header()
    marquee = Marquee()

    with dialogbox.messagebox.open(u"使用可能なディスクを調査中..."):
        q = multiprocessing.Queue()
        p = multiprocessing.Process(target=get_usable_disks,
                                    args=(install_image, q))
        p.start()
        while p.is_alive():
            gui.yieldFrame()
        p.join()
        rst = q.get_nowait()
        if isinstance(rst, Exception): raise rst
        disks, install_image = rst

    mainmenu = MainMenu()
    mme = MainMenuEventHandler()
    mainmenu.setEventHandler(mme)
    install.window = Install()
    tools.window = Tools()

    mainmenu_items = []

    if len(disks) > 0:
        mainmenu_items.append(
            MainMenu.ListItem(gui.res.icon_install,
                              gui.res.string_inst_inatall, install.window))
    mainmenu_items.append(
        MainMenu.ListItem(gui.res.icon_tools, gui.res.string_inst_tool,
                          tools.window))

    mainmenu.addItems(mainmenu_items)
    items_height = sum(map(lambda x: x.getHeight(), mainmenu_items))

    mainmenu.addItem(
        gui.list.Separator(332 - mainmenu.getMarginTop() - items_height))
    mainmenu.addItem(
        MainMenu.SmallListItem(gui.res.icon_shutdown,
                               gui.res.string_inst_end_))

    for disk in disks:
        install.window.addItem(
            gui.list.TextListItem(
                "%s %s(%s)" %
                (disk["vendor"], disk["model"], disk["size_str"]),
                gui.res.font_select_option, None, None,
                ("install", disk, u"%s %s(%s, %s)に Walbrixをインストールします" %
                 (disk["vendor"], disk["model"], disk["name"],
                  disk["size_str"]))))

    tools.window.addItem(
        gui.list.TextListItem(gui.res.string_inst_gui_benchmark,
                              gui.res.font_select_option, None, None,
                              ("benchmark", gui.res.string_inst_speed_desc)))
    tools.window.addItem(
        gui.list.TextListItem(gui.res.string_inst_console,
                              gui.res.font_select_option, None, None,
                              ("console", gui.res.string_linux_console_exit)))

    desktop.addChild("header", header, (0, 0), -1)
    desktop.addChild("marquee", marquee,
                     (0, gui.getScreen().get_height() - marquee.getHeight()),
                     -1)
    desktop.addChild("mainmenu", mainmenu, (0, header.getHeight()), 1)

    while True:
        mme.onChange(mainmenu)
        while gui.eventLoop(mainmenu) == None:
            pass
        selected = mainmenu.getSelected().getWindow()
        if selected == None: return False
        mainmenu.keepShowingCursor()
        while True:
            if gui.eventLoop(selected) == None: break
            action = selected.getSelected().getData()
            if action[0] == "install":
                install.run(action[1], install_image)
            elif action[0] == "benchmark":
                if not tools.benchmark_gui(): continue
            elif action[0] == "console":
                if not tools.console(): continue
Ejemplo n.º 10
0
# -*- coding: utf-8 -*-
"""IAM OVPN
Usage:
    iamovpn install [--config <config_path>]
    iamovpn run standalone [--config <config_path>]
    iamovpn run user_auth [--config <config_path>]
    iamovpn run user_connect [--config <config_path>]
    iamovpn run user_disconnect [--config <config_path>]

Options:
    -h, --help              Show this screen
    --config <config_path>  Specify config.json file [default: ./config.json]
"""

from docopt import docopt
import logging
import config
import install
import app

args = docopt(__doc__)
config.load(args['--config'])
logging.basicConfig(level=getattr(logging, config['logging']['level']))

if args.get('install'):
    install.run(config)

elif args.get('run') and args.get('standalone'):
    app.run(config)