'Build the package and copy the build to a temporary directory for
the purposes of testing this avoids creating pyc and __pycache__
directories inside the build directory'

def _build_temp_install(self):

    self.reinitialize_command('build', inplace=True)
    self.run_command('build')
    build_cmd = self.get_finalized_command('build')
    new_path = os.path.abspath(build_cmd.build_lib)
    tmp_dir = tempfile.mkdtemp(prefix=(self.package_name + '-test-'), dir=self.temp_root)
    self.tmp_dir = os.path.realpath(tmp_dir)
    self.testing_path = os.path.join(self.tmp_dir, os.path.basename(new_path))
    shutil.copytree(new_path, self.testing_path)
    if (self.docs_path is not None):
        new_docs_path = os.path.join(self.tmp_dir, os.path.basename(self.docs_path))
        shutil.copytree(self.docs_path, new_docs_path)
        self.docs_path = new_docs_path
    shutil.copy('setup.cfg', self.tmp_dir)
