mirror of
https://github.com/python/cpython.git
synced 2025-10-23 07:02:24 +00:00
Added the --dist-dir option to control where the archive(s) are put;
defaults to 'dist' (ie. no longer in the distribution root).
This commit is contained in:
parent
b5316188ee
commit
c0614105aa
1 changed files with 11 additions and 1 deletions
|
@ -64,6 +64,9 @@ class sdist (Command):
|
||||||
('keep-tree', 'k',
|
('keep-tree', 'k',
|
||||||
"keep the distribution tree around after creating " +
|
"keep the distribution tree around after creating " +
|
||||||
"archive file(s)"),
|
"archive file(s)"),
|
||||||
|
('dist-dir=', 'd',
|
||||||
|
"directory to put the source distribution archive(s) in "
|
||||||
|
"[default: dist]"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +97,7 @@ class sdist (Command):
|
||||||
|
|
||||||
self.formats = None
|
self.formats = None
|
||||||
self.keep_tree = 0
|
self.keep_tree = 0
|
||||||
|
self.dist_dir = None
|
||||||
|
|
||||||
self.archive_files = None
|
self.archive_files = None
|
||||||
|
|
||||||
|
@ -118,6 +122,9 @@ class sdist (Command):
|
||||||
raise DistutilsOptionError, \
|
raise DistutilsOptionError, \
|
||||||
"unknown archive format '%s'" % bad_format
|
"unknown archive format '%s'" % bad_format
|
||||||
|
|
||||||
|
if self.dist_dir is None:
|
||||||
|
self.dist_dir = "dist"
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
|
|
||||||
|
@ -667,11 +674,14 @@ class sdist (Command):
|
||||||
# Don't warn about missing meta-data here -- should be (and is!)
|
# Don't warn about missing meta-data here -- should be (and is!)
|
||||||
# done elsewhere.
|
# done elsewhere.
|
||||||
base_dir = self.distribution.get_fullname()
|
base_dir = self.distribution.get_fullname()
|
||||||
|
base_name = os.path.join(self.dist_dir, base_dir)
|
||||||
|
|
||||||
self.make_release_tree (base_dir, self.files)
|
self.make_release_tree (base_dir, self.files)
|
||||||
archive_files = [] # remember names of files we create
|
archive_files = [] # remember names of files we create
|
||||||
|
if self.dist_dir:
|
||||||
|
self.mkpath(self.dist_dir)
|
||||||
for fmt in self.formats:
|
for fmt in self.formats:
|
||||||
file = self.make_archive (base_dir, fmt, base_dir=base_dir)
|
file = self.make_archive (base_name, fmt, base_dir=base_dir)
|
||||||
archive_files.append(file)
|
archive_files.append(file)
|
||||||
|
|
||||||
self.archive_files = archive_files
|
self.archive_files = archive_files
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue