def stage_to_prod(self, src):
        """
        Copy file over to PROD_DIR. Return the new location of the
        file.
        """

        if not src.startswith(self.STAGE_DIR):
            raise BuildError(
                "Improper file '{0}' passed to stage_to_prod".format(src)
            )
        dst = src.replace(self.STAGE_DIR, self.PROD_DIR)
        dst_dir = os.path.dirname(dst)

        if self.STAGE_ONLY:
            self.log("Did not copy {0} to {1}".format(src, dst))
            return dst

        if not os.path.exists(dst_dir):
            os.makedirs(dst_dir)
        # copy2 will copy file metadata
        try:
            shutil.copy2(src, dst)
            self.log("Copied {0} to {1}".format(src, dst))
        except (__HOLE__, os.error) as why:
            raise BuildError(
                "cp -p {0} {1} caused {2}".format(src, dst, str(why))
            )
        except shutil.Error:
            raise
        return dst
dataset/ETHPy150Open mozilla/inventory/mozdns/mozbind/builder.py/DNSBuilder.stage_to_prod