def main(argv=None): import paramiko.util atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') if argv is None: argv = sys.argv[1:] parser = add_config_options(ArgumentParser()) parser.add_argument("-d", "--dest", action="store", type=str, dest="dest", default='.', help="destination directory where built package will go") parser.add_argument("-s", "--src", action="append", type=str, dest="srcs", default=[], help="source directory where package is located") parser.add_argument("-b", "--buildtype", action="store", type=str, dest="btype", default='bdist_egg', help="type of distribution to build") parser.add_argument("--py", action="store", type=str, dest="py", default='python', help="which python to use (default='python'") parser.add_argument("-k","--keep", action="store_true", dest='keep', help="if there are build failures, don't delete " "the temporary build directory " "or terminate the remote instance if testing on EC2.") options = parser.parse_args() config, conn, image_hosts = process_options(options) if not options.srcs: print "You must specify one or more source directories" parser.print_help() sys.exit(-1) options.srcs = [os.path.abspath(os.path.expanduser(s)) for s in options.srcs] funct_kwargs = { 'keep': options.keep, 'srcdirs': options.srcs, 'destdir': os.path.abspath(os.path.expanduser(options.dest)), 'build_type': options.btype, 'py': options.py, } retval = run_host_processes(config, conn, image_hosts, options, funct=remote_build, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) if retval == 0: cleanup('paramiko.log') sys.exit(retval)
def main(argv=None): import paramiko.util atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') if argv is None: argv = sys.argv[1:] parser = add_config_options(ArgumentParser()) parser.add_argument("-d", "--dest", action="store", type=str, dest="dest", default='.', help="destination directory where built package will go") parser.add_argument("-s", "--src", action="append", type=str, dest="srcs", default=[], help="source directory where package is located") parser.add_argument("-b", "--buildtype", action="store", type=str, dest="btype", default='bdist_egg', help="type of distribution to build") parser.add_argument("--py", action="store", type=str, dest="py", default='python', help="which python to use (default='python'") parser.add_argument("-k", "--keep", action="store_true", dest='keep', help="if there are build failures, don't delete " "the temporary build directory " "or terminate the remote instance if testing on EC2.") options = parser.parse_args() config, conn, image_hosts = process_options(options) if not options.srcs: print "You must specify one or more source directories" parser.print_help() sys.exit(-1) options.srcs = [os.path.abspath(os.path.expanduser(s)) for s in options.srcs] funct_kwargs = {'keep': options.keep, 'srcdirs': options.srcs, 'destdir': os.path.abspath(os.path.expanduser(options.dest)), 'build_type': options.btype, 'py': options.py, } retval = run_host_processes(config, conn, image_hosts, options, funct=remote_build, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) if retval == 0: cleanup('paramiko.log') sys.exit(retval)
def test_branch(parser, options, args=None): if args: print_sub_help(parser, 'test_branch') return -1 atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') options.filters = ['test_branch==true'] config, conn, ec2_hosts = process_options(options) if not options.hosts: parser.print_help() print "nothing to do - no hosts specified" sys.exit(0) if options.fname is None: # assume we're testing the current repo print 'creating tar file of current branch: ', options.fname = os.path.join(os.getcwd(), 'OpenMDAO-Framework-testbranch.tar') ziptarname = options.fname + '.gz' cleanup(ziptarname) # clean up the old tar file make_git_archive(options.fname, prefix='OpenMDAO-OpenMDAO-Framework-testbranch/') subprocess.check_call(['gzip', options.fname]) options.fname = os.path.abspath(ziptarname) print options.fname cleanup_tar = True else: cleanup_tar = False fname = options.fname if not (fname.startswith('http') or \ fname.startswith('git:') or fname.startswith('git@')): fname = os.path.abspath(os.path.expanduser(options.fname)) if fname.endswith('.tar.gz') or fname.endswith('.tar'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif fname.endswith('.git') or \ (fname.startswith('http') and os.path.splitext(fname)[1]==''): pass else: parser.print_help() print "\nfilename '%s' must specify a tar file or git repository" % fname sys.exit(-1) testargs = '-v ' if options.verbose else '' testargs += '--gui ' if options.gui else '' testargs += '--skip-gui ' if options.skip_gui else '' testargs += options.testargs funct_kwargs = {'keep': options.keep, 'testargs': testargs, 'fname': fname, 'remotedir': get_tmp_user_dir(), 'branch': options.branch, 'cfg': config } try: retcode = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) finally: if cleanup_tar: cleanup(ziptarname) if retcode == 0: cleanup('paramiko.log') return retcode
def test_release(parser, options): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') cleanup_files = [os.path.join(os.getcwd(), 'paramiko.log')] if options.fname is None: print '\nyou must supply a release directory' print ' or the pathname or URL of a go-openmdao-<version>.py file' sys.exit(-1) options.filters = ['test_release==true'] config, conn, ec2_hosts = process_options(options) fname = options.fname if fname.startswith('http'): # if they cut & paste from the openmdao website, the fname # will be followed by #md5=..., so get rid of that part fname = fname.split('#')[0] else: fname = os.path.abspath(os.path.expanduser(fname)) if fname.endswith('.py'): if not fname.startswith('http'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif _is_release_dir(fname): pass elif os.path.isdir(fname): #create a structured release directory release_dir = fname.replace('rel_', 'release_') subprocess.check_call(['release', 'push', fname, release_dir]) fname = options.fname = release_dir cleanup_files.append(release_dir) else: parser.print_help() print "\nfilename must be a release directory" print " or a pathname or URL of a go-openmdao.py file" sys.exit(-1) funct_kwargs = {'keep': options.keep, 'testargs': options.testargs, 'fname': fname, } if len(options.hosts) > 0: run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) else: # just run test locally print 'testing locally...' loctst = os.path.join(os.path.dirname(__file__), 'loc_bld_tst.py') tdir = tempfile.mkdtemp() cleanup_files.append(tdir) if os.path.isdir(fname): if not _is_release_dir(fname): fname = release_dir # find go file and get version number godir = os.path.join(fname, 'downloads', 'latest') gfiles = os.listdir(godir) gfiles = fnmatch.filter(gfiles, 'go-openmdao-*.py') try: gfiles.remove('go-openmdao-dev.py') except: pass if len(gfiles) != 1: print "Need 1 go-openmdao-<version>.py file to run, but found %s" % gfiles sys.exit(-1) fname = os.path.join(fname, 'downloads', 'latest', gfiles[0]) cmd = [sys.executable, loctst, '-f', fname, '-d', tdir] if options.testargs: cmd.append('--testargs="%s"' % options.testargs) subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) if options.keep: print "the following files/directories were not cleaned up: %s" % cleanup_files else: cleanup(*cleanup_files)
def test_branch(parser, options, args=None): if args: print_sub_help(parser, 'test_branch') return -1 atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') options.filters = ['test_branch==true'] config, conn, ec2_hosts = process_options(options) if not options.hosts: parser.print_help() print "nothing to do - no hosts specified" sys.exit(0) if options.fname is None: # assume we're testing the current repo print 'creating tar file of current branch: ', options.fname = os.path.join(os.getcwd(), 'OpenMDAO-Framework-testbranch.tar') ziptarname = options.fname + '.gz' cleanup(ziptarname) # clean up the old tar file make_git_archive(options.fname, prefix='OpenMDAO-OpenMDAO-Framework-testbranch/') subprocess.check_call(['gzip', options.fname]) options.fname = os.path.abspath(ziptarname) print options.fname cleanup_tar = True else: cleanup_tar = False fname = options.fname if not (fname.startswith('http') or \ fname.startswith('git:') or fname.startswith('git@')): fname = os.path.abspath(os.path.expanduser(options.fname)) if fname.endswith('.tar.gz') or fname.endswith('.tar'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif fname.endswith('.git') or \ (fname.startswith('http') and os.path.splitext(fname)[1]==''): pass else: parser.print_help() print "\nfilename '%s' must specify a tar file or git repository" % fname sys.exit(-1) testargs = '-v ' if options.verbose else '' testargs += '--gui ' if options.gui else '' testargs += '--skip-gui ' if options.skip_gui else '' testargs += options.testargs funct_kwargs = { 'keep': options.keep, 'testargs': testargs, 'fname': fname, 'remotedir': get_tmp_user_dir(), 'branch': options.branch, 'cfg': config } try: retcode = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) finally: if cleanup_tar: cleanup(ziptarname) if retcode == 0: cleanup('paramiko.log') return retcode
def test_release(parser, options): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') cleanup_files = [os.path.join(os.getcwd(), 'paramiko.log')] if options.fname is None: print '\nyou must supply a release directory' print ' or the pathname or URL of a go-openmdao-<version>.py file' sys.exit(-1) options.filters = ['test_release==true'] config, conn, ec2_hosts = process_options(options) fname = options.fname if fname.startswith('http'): # if they cut & paste from the openmdao website, the fname # will be followed by #md5=..., so get rid of that part fname = fname.split('#')[0] else: fname = os.path.abspath(os.path.expanduser(fname)) if fname.endswith('.py'): if not fname.startswith('http'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif _is_release_dir(fname): pass elif os.path.isdir(fname): #create a structured release directory release_dir = fname.replace('rel_', 'release_') subprocess.check_call(['release', 'push', fname, release_dir]) fname = options.fname = release_dir cleanup_files.append(release_dir) else: parser.print_help() print "\nfilename must be a release directory" print " or a pathname or URL of a go-openmdao.py file" sys.exit(-1) funct_kwargs = { 'keep': options.keep, 'testargs': options.testargs, 'fname': fname, } if len(options.hosts) > 0: run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) else: # just run test locally print 'testing locally...' loctst = os.path.join(os.path.dirname(__file__), 'loc_bld_tst.py') tdir = tempfile.mkdtemp() cleanup_files.append(tdir) if os.path.isdir(fname): if not _is_release_dir(fname): fname = release_dir # find go file and get version number godir = os.path.join(fname, 'downloads', 'latest') gfiles = os.listdir(godir) gfiles = fnmatch.filter(gfiles, 'go-openmdao-*.py') try: gfiles.remove('go-openmdao-dev.py') except: pass if len(gfiles) != 1: print "Need 1 go-openmdao-<version>.py file to run, but found %s" % gfiles sys.exit(-1) fname = os.path.join(fname, 'downloads', 'latest', gfiles[0]) cmd = [sys.executable, loctst, '-f', fname, '-d', tdir] if options.testargs: cmd.append('--testargs="%s"' % options.testargs) subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) if options.keep: print "the following files/directories were not cleaned up: %s" % cleanup_files else: cleanup(*cleanup_files)
def test_branch(argv=None): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') if argv is None: argv = sys.argv[1:] parser = ArgumentParser() add_config_options(parser) parser.add_argument("-k","--keep", action="store_true", dest='keep', help="Don't delete the temporary build directory. " "If testing on EC2 stop the instance instead of terminating it.") parser.add_argument("-f","--file", action="store", type=str, dest='fname', help="Pathname of a tarfile or URL of a git repo. " "Defaults to the current repo.") parser.add_argument("-b","--branch", action="store", type=str, dest='branch', help="If file is a git repo, supply branch name here") parser.add_argument("--testargs", action="store", type=str, dest='testargs', default='', help="args to be passed to openmdao test") options = parser.parse_args() options.filters = ['test_branch==true'] config, conn, ec2_hosts = process_options(options) if not options.hosts: parser.print_help() print "nothing to do - no hosts specified" sys.exit(0) startdir = os.getcwd() if options.fname is None: # assume we're testing the current repo print 'creating tar file of current branch: ', options.fname = os.path.join(os.getcwd(), 'testbranch.tar') ziptarname = options.fname+'.gz' cleanup(ziptarname) # clean up the old tar file make_git_archive(options.fname) subprocess.check_call(['gzip', options.fname]) options.fname = os.path.abspath(ziptarname) print options.fname cleanup_tar = True else: cleanup_tar = False fname = options.fname if not (fname.startswith('http') or fname.startswith('git:') or fname.startswith('git@')): fname = os.path.abspath(os.path.expanduser(options.fname)) if fname.endswith('.tar.gz') or fname.endswith('.tar'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif fname.endswith('.git') or (fname.startswith('http') and os.path.splitext(fname)[1]==''): pass else: parser.print_help() print "\nfilename '%s' must specify a tar file or git repository" % fname sys.exit(-1) funct_kwargs = { 'keep': options.keep, 'testargs': options.testargs, 'fname': fname, 'remotedir': get_tmp_user_dir(), 'branch': options.branch, } try: retcode = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) finally: if cleanup_tar: cleanup(ziptarname) if retcode == 0: cleanup('paramiko.log') return retcode
def test_branch(argv=None): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') if argv is None: argv = sys.argv[1:] parser = CfgOptionParser(usage="%prog [OPTIONS] -- [options to openmdao_test]") parser.add_option("-k","--keep", action="store_true", dest='keep', help="Don't delete the temporary build directory. " "If testing on EC2 stop the instance instead of terminating it.") parser.add_option("-f","--file", action="store", type='string', dest='fname', help="Pathname of a tarfile or URL of a git repo. " "Defaults to the current repo.") parser.add_option("-b","--branch", action="store", type='string', dest='branch', help="If file is a git repo, supply branch name here") (options, args) = parser.parse_args(argv) config, conn, ec2_hosts = process_options(options, parser) if not options.hosts: parser.print_help() print "nothing to do - no hosts specified" sys.exit(0) startdir = os.getcwd() if options.fname is None: # assume we're testing the current repo print 'creating tar file of current branch: ', options.fname = os.path.join(os.getcwd(), 'testbranch.tar') ziptarname = options.fname+'.gz' cleanup(ziptarname) # clean up the old tar file make_git_archive(options.fname) subprocess.check_call(['gzip', options.fname]) options.fname = os.path.abspath(ziptarname) print options.fname cleanup_tar = True else: cleanup_tar = False fname = os.path.abspath(os.path.expanduser(options.fname)) if fname.endswith('.tar.gz') or fname.endswith('.tar'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif fname.endswith('.git'): pass else: parser.print_help() print "\nfilename must end in '.tar.gz', '.tar', or '.git'" sys.exit(-1) funct_kwargs = { 'keep': options.keep, 'testargs': args, 'fname': fname, 'remotedir': get_tmp_user_dir(), 'branch': options.branch, } try: retcode = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs) finally: if cleanup_tar: cleanup(ziptarname) if retcode == 0: cleanup('paramiko.log') return retcode
def test_release(argv=None): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') cleanup_files = ['paramiko.log'] if argv is None: argv = sys.argv[1:] parser = CfgOptionParser(usage="%prog [OPTIONS] -- [options to openmdao_test]") parser.add_option("-k","--keep", action="store_true", dest='keep', help="Don't delete the temporary build directory. " "If testing on EC2 stop the instance instead of terminating it.") parser.add_option("-f","--file", action="store", type='string', dest='fname', help="URL or pathname of a go-openmdao.py file or pathname of a release dir") (options, args) = parser.parse_args(argv) if options.fname is None: parser.print_help() print '\nyou must supply a release directory or the pathname or URL of a go-openmdao.py file' sys.exit(-1) config, conn, ec2_hosts = process_options(options, parser) startdir = os.getcwd() fname = options.fname if fname.startswith('http'): # if they cut & paste from the openmdao website, the fname # will be followed by #md5=..., so get rid of that part fname = fname.split('#')[0] else: fname = os.path.abspath(os.path.expanduser(fname)) if fname.endswith('.py'): if not fname.startswith('http'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif _is_release_dir(fname): pass elif os.path.isdir(fname): #create a structured release directory release_dir = "%s__release" % fname subprocess.check_call(['push_release', fname, release_dir]) fname = options.fname = release_dir cleanup_files.append(release_dir) else: parser.print_help() print "\nfilename must be a release directory or a pathname or URL of a go-openmdao.py file" sys.exit(-1) funct_kwargs = { 'keep': options.keep, 'testargs': args, 'fname': fname, } retval = 0 if len(options.hosts) > 0: retval = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs) if not options.keep: cleanup(*cleanup_files)
def test_branch(argv=None): atexit.register(fabric_cleanup, True) paramiko.util.log_to_file('paramiko.log') if argv is None: argv = sys.argv[1:] parser = ArgumentParser() add_config_options(parser) parser.add_argument( "-k", "--keep", action="store_true", dest='keep', help="Don't delete the temporary build directory. " "If testing on EC2 stop the instance instead of terminating it.") parser.add_argument("-f", "--file", action="store", type=str, dest='fname', help="Pathname of a tarfile or URL of a git repo. " "Defaults to the current repo.") parser.add_argument("-b", "--branch", action="store", type=str, dest='branch', help="If file is a git repo, supply branch name here") parser.add_argument("--testargs", action="store", type=str, dest='testargs', default='', help="args to be passed to openmdao test") options = parser.parse_args() options.filters = ['test_branch==true'] config, conn, ec2_hosts = process_options(options) if not options.hosts: parser.print_help() print "nothing to do - no hosts specified" sys.exit(0) startdir = os.getcwd() if options.fname is None: # assume we're testing the current repo print 'creating tar file of current branch: ', options.fname = os.path.join(os.getcwd(), 'testbranch.tar') ziptarname = options.fname + '.gz' cleanup(ziptarname) # clean up the old tar file make_git_archive(options.fname) subprocess.check_call(['gzip', options.fname]) options.fname = os.path.abspath(ziptarname) print options.fname cleanup_tar = True else: cleanup_tar = False fname = options.fname if not (fname.startswith('http') or fname.startswith('git:') or fname.startswith('git@')): fname = os.path.abspath(os.path.expanduser(options.fname)) if fname.endswith('.tar.gz') or fname.endswith('.tar'): if not os.path.isfile(fname): print "can't find file '%s'" % fname sys.exit(-1) elif fname.endswith('.git') or (fname.startswith('http') and os.path.splitext(fname)[1] == ''): pass else: parser.print_help() print "\nfilename '%s' must specify a tar file or git repository" % fname sys.exit(-1) funct_kwargs = { 'keep': options.keep, 'testargs': options.testargs, 'fname': fname, 'remotedir': get_tmp_user_dir(), 'branch': options.branch, } try: retcode = run_host_processes(config, conn, ec2_hosts, options, funct=_remote_build_and_test, funct_kwargs=funct_kwargs, done_functs=[print_host_codes]) finally: if cleanup_tar: cleanup(ziptarname) if retcode == 0: cleanup('paramiko.log') return retcode