Esempio n. 1
0
    os.environ['PYTHONPATH'] = '.;..;../..'
    system('%s testrunner.py --expected ../known_failures.txt' % sys.executable)
elif args[0:1] == ['dist']:
    prepare()
    success = 0
    for command in ['bdist_egg', 'bdist_wininst', 'bdist_msi']:
        cmd = sys.executable + ' setup.py ' + command
        if not system(cmd, exit=False):
            success += 1
    if not success:
        sys.exit('bdist_egg bdist_wininst and bdist_msi all failed')
elif not args:
    assert options.host
    if not options.source:
        import makedist
        options.source = makedist.makedist()

    options.source_name = os.path.basename(options.source)
    options.script_path = os.path.abspath(__file__)
    options.script_name = os.path.basename(__file__)

    if options.python.isdigit():
        options.python = 'C:/Python' + options.python + '/python.exe'

    tar_name = options.source_name.rsplit('.', 1)[0]
    dir_name = tar_name.rsplit('.', 1)[0]
    options.dir_name = dir_name

    system('scp %(source)s %(script_path)s %(username)s@%(host)s:' % options.__dict__)
    if options.dist:
        system('ssh %(username)s@%(host)s %(python)s -u %(script_name)s dist %(source_name)s' % options.__dict__)
Esempio n. 2
0
    system('%s testrunner.py --expected ../known_failures.txt' %
           sys.executable)
elif args[0:1] == ['dist']:
    prepare()
    success = 0
    for command in ['bdist_egg', 'bdist_wininst', 'bdist_msi']:
        cmd = sys.executable + ' setup.py ' + command
        if not system(cmd, exit=False):
            success += 1
    if not success:
        sys.exit('bdist_egg bdist_wininst and bdist_msi all failed')
elif not args:
    assert options.host
    if not options.source:
        import makedist
        options.source = makedist.makedist()

    options.source_name = os.path.basename(options.source)
    options.script_path = os.path.abspath(__file__)
    options.script_name = os.path.basename(__file__)

    if options.python.isdigit():
        options.python = 'C:/Python' + options.python + '/python.exe'

    tar_name = options.source_name.rsplit('.', 1)[0]
    dir_name = tar_name.rsplit('.', 1)[0]
    options.dir_name = dir_name

    system('scp %(source)s %(script_path)s %(username)s@%(host)s:' %
           options.__dict__)
    if options.dist:
Esempio n. 3
0
def main():
    import optparse
    import uuid
    import virtualbox
    parser = optparse.OptionParser()
    parser.add_option('--source')
    parser.add_option('--fast', action='store_true')
    parser.add_option('--revert', action='store_true')
    parser.add_option('--clean', action='store_true')
    parser.add_option('--python', default='27')
    parser.add_option('--machine')
    parser.add_option('--username')
    parser.add_option('--password', default='')
    parser.add_option('--version', default='dev')
    parser.add_option('-v', '--verbose', action='store_true')
    parser.add_option('--type', default='headless')

    options, args = parser.parse_args()

    system.noisy = options.verbose

    if not args or args[0] not in ['build', 'test', 'dist', 'noop']:
        sys.exit('Expected a command: build|test|dist')

    command = args[0]
    command_args = args[1:]

    if options.username is None:
        import getpass
        options.username = getpass.getuser()

    if not options.source:
        import makedist
        options.source = makedist.makedist('dev', fast=True)
    options.source = os.path.abspath(options.source)

    options.unique = uuid.uuid4().hex
    directory = 'c:/tmpdir.%s' % options.unique

    python = options.python
    if not python.endswith('exe') and '/' not in python:
        python = 'C:/Python%s/python.exe' % python

    if not options.machine:
        options.machine = get_default_machine()

    print 'Using directory %r on machine %r. Python: %s' % (directory, options.machine, python)

    this_script = __file__
    if this_script.lower().endswith('.pyc'):
        this_script = this_script[:-1]
    this_script_remote = '%s/%s' % (directory, os.path.basename(this_script))

    machine = virtualbox.VirtualBox(options.machine, options.username, options.password, type=options.type)
    machine.start()
    try:
        machine.mkdir(directory)
        machine.copyto(options.source, directory + '/' + os.path.basename(options.source))
        machine.copyto(this_script, this_script_remote)

        machine.script_path = this_script_remote
        machine.python_path = python
        machine.directory = directory

        function = globals().get('command_%s' % command, command_default)
        function(command, command_args, machine, options)
    finally:
        machine.stop()