示例#1
0
def refresh_metadata(cmd: Command) -> None:
    # distutils remembers what commands are run during a build so that
    # subsequent calls to the command are skipped. This means that metadata is
    # normally only created once even if multiple builds are being done (e.g.,
    # 'python setup.py sdist bdist_wheel'). Since package data is dynamically
    # built depending on the type of build, we need to ensure that any stale
    # metadata is refreshed.
    if cmd.distribution.have_run.get('egg_info', 0):
        cmd.distribution.reinitialize_command('egg_info')
        cmd.run_command('egg_info')