• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Create a dist_info directory
3As defined in the wheel specification
4"""
5
6import os
7
8from distutils.core import Command
9from distutils import log
10
11
12class dist_info(Command):
13
14    description = 'create a .dist-info directory'
15
16    user_options = [
17        ('egg-base=', 'e', "directory containing .egg-info directories"
18                           " (default: top of the source tree)"),
19    ]
20
21    def initialize_options(self):
22        self.egg_base = None
23
24    def finalize_options(self):
25        pass
26
27    def run(self):
28        egg_info = self.get_finalized_command('egg_info')
29        egg_info.egg_base = self.egg_base
30        egg_info.finalize_options()
31        egg_info.run()
32        dist_info_dir = egg_info.egg_info[:-len('.egg-info')] + '.dist-info'
33        log.info("creating '{}'".format(os.path.abspath(dist_info_dir)))
34
35        bdist_wheel = self.get_finalized_command('bdist_wheel')
36        bdist_wheel.egg2dist(egg_info.egg_info, dist_info_dir)
37