def prepare_metadata(self):<EOL>
assert self.source_dir<EOL>with indent_log():<EOL><INDENT>if self.use_pep517:<EOL><INDENT>self.prepare_pep517_metadata()<EOL><DEDENT>else:<EOL><INDENT>self.run_egg_info()<EOL><DEDENT><DEDENT>if not self.req:<EOL><INDENT>if isinstance(parse_version(self.metadata["<STR_LIT>"]), Version):<EOL><INDENT>op = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>op = "<STR_LIT>"<EOL><DEDENT>self.req = Requirement(<EOL>"<STR_LIT>".join([<EOL>self.metadata["<STR_LIT:Name>"],<EOL>op,<EOL>self.metadata["<STR_LIT>"],<EOL>])<EOL>)<EOL>self._correct_build_location()<EOL><DEDENT>else:<EOL><INDENT>metadata_name = canonicalize_name(self.metadata["<STR_LIT:Name>"])<EOL>if canonicalize_name(self.req.name) != metadata_name:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>self.name, metadata_name, self.name<EOL>)<EOL>self.req = Requirement(metadata_name)<EOL><DEDENT><DEDENT>
Ensure that project metadata is available.

        Under PEP 517, call the backend hook to prepare the metadata.
        Under legacy processing, call setup.py egg-info.