Beispiel #1
0
def loadMenu():
    os.system('clear')
    choice = 0
    while (1):
        print("What do you want to do")
        print("1. Add a new task")
        print("2. Login to a different date")
        print("3. Update an exisiting task")
        print("4. Remove an exisiting task")
        print("5. Go back to dashboard")
        print("0. Exit")
        choice = int(input())
        if (choice not in {0, 1, 2, 3, 4, 5}):
            choice = int(input())
        else:
            break
    if (choice == 0):
        exit()
    elif (choice == 1):
        loadAdd(todo)
    elif (choice == 2):
        loadUpdate(todo)
    elif (choice == 3):
        loadRemove(todo)
    loadDashboardTodo(todo)
Beispiel #2
0
def loadDashboardCompleted(todo):
    c = loadDashboardCommon("Completed", "←", "a or A")
    try:
        if (c == "a" or c == "A"):
            loadDashboardTodo(todo)
        elif (c == "l" or c == "L"):
            login(todo)
        elif (int(c) == 1):
            loadMenu()
        else:
            exit()
    except ValueError:
        loadDashboardCompleted(todo)
Beispiel #3
0
def loadDashboardTodo(todo):
    c = loadDashboardCommon("ToDo", "→", "d or D")
    try:
        if (c == "d" or c == "D"):
            loadDashboardCompleted(todo)
        elif (c == "l" or c == "L"):
            login(todo)
        elif (int(c) == 1):
            loadMenu()
        else:
            exit()
    except ValueError:
        loadDashboardTodo(todo)
Beispiel #4
0
def run():
    """
    Constantly creates new containers until the container queue is full.
    
    """
    
    log = logging.getLogger("galah.sheep.producer")
    
    log.info("Producer is starting")
    
    # Get a list of all of the clean virtual machines that already exist
    cleanMachines = pyvz.getContainers("galah-vm: clean")
    
    # Add all the clean VMs to the queue
    for m in cleanMachines:
        utility.enqueue(universal.containers, m)
        
        log.info("Reusing clean VM with CTID %d" % m)
    
    # Loop until the program is shutting down
    while utility.waitForQueue(universal.containers):
        log.debug("Creating new VM")
        
        try:
            # Create new container with unique id
            id = pyvz.createContainer(
                    zosTemplate = universal.cmdOptions.ostemplate,
                    zdescription = "galah-vm: clean")
        except (RuntimeError, SystemError):
            log.exception("Error occured when creating VM")
            
            # Sleep for a bit and then try again
            time.sleep(5)
            continue
            
        log.debug("Created new VM with CTID %d" % id)
        
        try:
            # Start container
            pyvz.startContainer(id)
        except SystemError:
            log.exception("Could not start VM with CTID %d" % id)
            
            # If I keep trying to create VMs and starting them and it keeps
            # failing I may end up with hundreds of broken virtual machines
            # bogging down my server. I could add somewhat sophisticated
            # cleanup code ehre but this seems to be such a vital error that
            # shutting down is a reasonable option.
            log.critical("Cannot recover from non-starting VM")
            
            raise utility.exit()
        
        
        # Try to add the container to the queue until successful or the program
        # is exiting.
        utility.enqueue(universal.containers, id)
                
        log.debug("Added VM with CTID %d to the queue" % id)
Beispiel #5
0
def run():
    """
    Constantly creates new containers until the container queue is full.
    
    """

    log = logging.getLogger("galah.sheep.producer")

    log.info("Producer is starting")

    # Get a list of all of the clean virtual machines that already exist
    cleanMachines = pyvz.getContainers("galah-vm: clean")

    # Add all the clean VMs to the queue
    for m in cleanMachines:
        utility.enqueue(universal.containers, m)

        log.info("Reusing clean VM with CTID %d" % m)

    # Loop until the program is shutting down
    while utility.waitForQueue(universal.containers):
        log.debug("Creating new VM")

        try:
            # Create new container with unique id
            id = pyvz.createContainer(
                zosTemplate=universal.cmdOptions.ostemplate,
                zdescription="galah-vm: clean")
        except (RuntimeError, SystemError):
            log.exception("Error occured when creating VM")

            # Sleep for a bit and then try again
            time.sleep(5)
            continue

        log.debug("Created new VM with CTID %d" % id)

        try:
            # Start container
            pyvz.startContainer(id)
        except SystemError:
            log.exception("Could not start VM with CTID %d" % id)

            # If I keep trying to create VMs and starting them and it keeps
            # failing I may end up with hundreds of broken virtual machines
            # bogging down my server. I could add somewhat sophisticated
            # cleanup code ehre but this seems to be such a vital error that
            # shutting down is a reasonable option.
            log.critical("Cannot recover from non-starting VM")

            raise utility.exit()

        # Try to add the container to the queue until successful or the program
        # is exiting.
        utility.enqueue(universal.containers, id)

        log.debug("Added VM with CTID %d to the queue" % id)
Beispiel #6
0
llvm_key_url = 'http://llvm.org/apt/llvm-snapshot.gpg.key'

repository = {
    '3.4': 'deb http://llvm.org/apt/precise llvm-toolchain-precise-3.4 main',
    '3.5': 'deb http://llvm.org/apt/precise llvm-toolchain-precise-3.5 main',
    '3.6': 'deb http://llvm.org/apt/precise llvm-toolchain-precise-3.6 main',
}

backport = 'ppa:ubuntu-toolchain-r/test'

if __name__ == '__main__':
    print('Checking environment variables...')
    try:
        version = getenv('PACKAGE')
        cxx = getenv('CXX')
    except EnvironError as e: exit(e)

    clang = 'clang' in cxx

    # download the cmake install script, mark executable
    print('Downloading CMake Installer...')
    try: download(cmake_script_url, 'cmake-amd64.sh')
    except DownloadError as e: exit(e)
    make_executable('cmake-amd64.sh')

    # add gcc to repos
    print('Adding GCC Repository...')
    sudo('add-apt-repository', '--yes', backport)

    if clang:
        # download the llvm package key for the repositories
Beispiel #7
0
from utility import getenv
from utility import which
from utility import sudo
from utility import exit
from os.path import normcase as normalize
from os.path import isdir
from os.path import join
from os import getcwd
from os import pathsep
from os import listdir

if __name__ == '__main__':
    print('Checking environment variables...')
    try:
        build_type = getenv('BUILD_TYPE')
        version = getenv('PACKAGE')
        cxx = getenv('CXX')
    except EnvironError as e: exit(e)

    clang = 'clang' in cxx

    print('Installing CMake...')
    sudo('./cmake-amd64.sh', '--skip-license', '--prefix=/usr')

    if clang:
        print('Installing Compiler Dependencies...')
        sudo('apt-get', 'install', '-qq', 'g++-4.9')

    print('Installing Compiler...')
    sudo('apt-get', 'install', '-qq', '{}-{}'.format(cxx, version))
Beispiel #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# travis-build.py - build script
# Written in 2015 by MNMLSTC
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty. You should have
# received a copy of the CC0 Public Domain Dedication along with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

from __future__ import print_function
from utility import LocateError
from utility import execute
from utility import which
from utility import exit

if __name__ == '__main__':
    try:
        execute(which('cmake'), '--build', 'build', '--target', 'check')
    except LocateError as e:
        exit(e)
Beispiel #9
0
def template (path): return Template(read(path))
def load (path): return loads(read(path))

PKG_ROOT = '_CPack_Packages/Darwin/PKG'
SRC_ROOT = '_CPack_Packages/Darwin/STGZ'

if __name__ == '__main__':
    productbuild = which('productbuild')
    pkgbuild = which('pkgbuild')

    p = parser()
    args = p.parse_args()

    config_file = join(abspath(args.resource), 'pkg.json')
    try: data = load(config_file)
    except Exception as e: exit(e)

    template_file = join(abspath(args.resource), data['template'])
    try: distribution = template(template_file)
    except Exception as e: exit(e)

    # Don't care if we error with an exception here
    pkg_identifier = data['identifier']
    pkg_version = data['version']
    pkg_name = '{}-{}'.format(data['package'], pkg_version)

    license_file = join(abspath(args.resource), data['license'])

    build_dir = join(getcwd(), args.build)
    package_dir = join(build_dir, 'package')
    distribution_xml = join(PKG_ROOT, 'distribution.xml')
Beispiel #10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# travis-build.py - build script
# Written in 2015 by MNMLSTC
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty. You should have
# received a copy of the CC0 Public Domain Dedication along with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.


from __future__ import print_function
from utility import LocateError
from utility import execute
from utility import which
from utility import exit

if __name__ == '__main__':
    try: execute(which('cmake'), '--build', 'build', '--target', 'check')
    except LocateError as e: exit(e)
Beispiel #11
0
from utility import EnvironError
from utility import LocateError
from utility import execute
from utility import getenv
from utility import which
from utility import exit
from os.path import join
from os import getcwd
from os import mkdir

if __name__ == '__main__':
    try:
        build_type = getenv('BUILD_TYPE')
        version = getenv('PACKAGE')
        cxx = getenv('CXX')
    except EnvironError as e: exit(e)
    current = getcwd()
    build = join(current, 'build')
    arguments = [
        current,
        '-DCMAKE_CXX_COMPILER:STRING={}-{}'.format(cxx, version),
        '-DCMAKE_BUILD_TYPE:STRING={}'.format(build_type),
        '-DBUILD_WITH_LIBCXX:BOOL=OFF',
        '-DBUILD_TESTING:BOOL=ON'
    ]
    try: arguments.insert(0, which('cmake'))
    except LocateError as e: exit(e)
    try: mkdir('build')
    except OSError as e: exit(e)
    execute(*arguments, cwd=build)