1010from types import *
1111from glob import glob
1212from distutils .core import Command
13- from distutils .util import \
14- create_tree , remove_tree , newer , write_file , \
15- check_archive_formats
13+ from distutils import dir_util , dep_util , file_util , archive_util
1614from distutils .text_file import TextFile
1715from distutils .errors import *
1816from distutils .filelist import FileList
@@ -117,7 +115,7 @@ def finalize_options (self):
117115 "don't know how to create source distributions " + \
118116 "on platform %s" % os .name
119117
120- bad_format = check_archive_formats (self .formats )
118+ bad_format = archive_util . check_archive_formats (self .formats )
121119 if bad_format :
122120 raise DistutilsOptionError , \
123121 "unknown archive format '%s'" % bad_format
@@ -195,7 +193,7 @@ def get_file_list (self):
195193 # manifest; if so, we'll regenerate the manifest.
196194 template_exists = os .path .isfile (self .template )
197195 if template_exists :
198- template_newer = newer (self .template , self .manifest )
196+ template_newer = dep_util . newer (self .template , self .manifest )
199197
200198 # The contents of the manifest file almost certainly depend on the
201199 # setup script as well as the manifest template -- so if the setup
@@ -204,7 +202,7 @@ def get_file_list (self):
204202 # manifest, but there's no template -- which will happen if the
205203 # developer elects to generate a manifest some other way -- then we
206204 # can't regenerate the manifest, so we don't.)
207- setup_newer = newer (sys .argv [0 ], self .manifest )
205+ setup_newer = dep_util . newer (sys .argv [0 ], self .manifest )
208206
209207 # cases:
210208 # 1) no manifest, template exists: generate manifest
@@ -368,7 +366,7 @@ def write_manifest (self):
368366 by 'add_defaults()' and 'read_template()') to the manifest file
369367 named by 'self.manifest'.
370368 """
371- self .execute (write_file ,
369+ self .execute (file_util . write_file ,
372370 (self .manifest , self .filelist .files ),
373371 "writing manifest file '%s'" % self .manifest )
374372
@@ -404,8 +402,8 @@ def make_release_tree (self, base_dir, files):
404402 """
405403 # Create all the directories under 'base_dir' necessary to
406404 # put 'files' there.
407- create_tree (base_dir , files ,
408- verbose = self .verbose , dry_run = self .dry_run )
405+ dir_util . create_tree (base_dir , files ,
406+ verbose = self .verbose , dry_run = self .dry_run )
409407
410408 # And walk over the list of files, either making a hard link (if
411409 # os.link exists) to each one that doesn't already exist in its
@@ -453,7 +451,7 @@ def make_distribution (self):
453451 self .archive_files = archive_files
454452
455453 if not self .keep_tree :
456- remove_tree (base_dir , self .verbose , self .dry_run )
454+ dir_util . remove_tree (base_dir , self .verbose , self .dry_run )
457455
458456 def get_archive_files (self ):
459457 """Return the list of archive files created when the command
0 commit comments