mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Added missing import.
Fixed 'make_release_tree()' to copy files if 'os.link()' doesn't exist.
This commit is contained in:
parent
cbeca7b408
commit
1b3a9af5cf
1 changed files with 23 additions and 8 deletions
|
@ -13,6 +13,7 @@ from glob import glob
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from distutils.core import Command
|
from distutils.core import Command
|
||||||
from distutils.text_file import TextFile
|
from distutils.text_file import TextFile
|
||||||
|
from distutils.errors import DistutilsExecError
|
||||||
|
|
||||||
|
|
||||||
# Possible modes of operation:
|
# Possible modes of operation:
|
||||||
|
@ -388,16 +389,30 @@ class Dist (Command):
|
||||||
for dir in need_dirs:
|
for dir in need_dirs:
|
||||||
self.mkpath (dir)
|
self.mkpath (dir)
|
||||||
|
|
||||||
# And walk over the list of files, making a hard link for
|
# And walk over the list of files, either making a hard link (if
|
||||||
# each one that doesn't already exist in its corresponding
|
# os.link exists) to each one that doesn't already exist in its
|
||||||
# location under 'base_dir'
|
# corresponding location under 'base_dir', or copying each file
|
||||||
|
# that's out-of-date in 'base_dir'. (Usually, all files will be
|
||||||
|
# out-of-date, because by default we blow away 'base_dir' when
|
||||||
|
# we're done making the distribution archives.)
|
||||||
|
|
||||||
self.announce ("making hard links in %s..." % base_dir)
|
try:
|
||||||
|
link = os.link
|
||||||
|
msg = "making hard links in %s..." % base_dir
|
||||||
|
except AttributeError:
|
||||||
|
link = 0
|
||||||
|
msg = "copying files to %s..." % base_dir
|
||||||
|
|
||||||
|
self.announce (msg)
|
||||||
for file in files:
|
for file in files:
|
||||||
dest = os.path.join (base_dir, file)
|
dest = os.path.join (base_dir, file)
|
||||||
if not os.path.exists (dest):
|
if link:
|
||||||
self.execute (os.link, (file, dest),
|
if not os.path.exists (dest):
|
||||||
"linking %s -> %s" % (file, dest))
|
self.execute (os.link, (file, dest),
|
||||||
|
"linking %s -> %s" % (file, dest))
|
||||||
|
else:
|
||||||
|
self.copy_file (file, dest)
|
||||||
|
|
||||||
# make_release_tree ()
|
# make_release_tree ()
|
||||||
|
|
||||||
|
|
||||||
|
@ -453,7 +468,7 @@ class Dist (Command):
|
||||||
import zipfile
|
import zipfile
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DistutilsExecError, \
|
raise DistutilsExecError, \
|
||||||
("unable to create zip file '%s.zip':" +
|
("unable to create zip file '%s.zip': " +
|
||||||
"could neither find a standalone zip utility nor " +
|
"could neither find a standalone zip utility nor " +
|
||||||
"import the 'zipfile' module") % base_dir
|
"import the 'zipfile' module") % base_dir
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue