def make_new_setupfile(setupfile):
    """If setuptools is not installed, make a new setup file that will
    bootstrap and use setuptools. The new file will be in the same location
    as setupfile and will have '_new_' prepended to the name.
    """
    setupfile = os.path.abspath(setupfile)
    newsetupfile = os.path.join(os.path.dirname(setupfile),
                                '_new_'+os.path.basename(setupfile))
    
    startdir = os.getcwd()
    
    os.chdir(os.path.dirname(setupfile))
    
    try:
        print "setuptools is not installed."
        if not os.path.isfile('ez_setup.py'):
            print "Attempting to download ez_setup.py"
            resp = urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py')
            with open('ez_setup.py', 'wb') as easyf:
                shutil.copyfileobj(resp.fp, easyf)
            print 'successfully downloaded ez_setup.py'

        print setupfile % "Attempting to update %s to import from ez_setup"
        
        if not os.path.isfile(setupfile):
            raise IOError("can't find setup file '%s'" % setupfile)
        
        setupf = open(setupfile, 'r')
        setup_contents = setupf.read()
        setupf.close()
        
        with open(newsetupfile, 'wb') as newf:
            newf.write("from ez_setup import use_setuptools\n")
            newf.write("use_setuptools(download_delay=0)\n\n")
            newf.write(setup_contents)
    finally:
        os.chdir(startdir)
        
    return newsetupfile
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.devtools/src/openmdao/devtools/locdistbld.py/make_new_setupfile/swapped operands of `%`