Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
766d1fbd
Commit
766d1fbd
authored
May 16, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16314: Added support for the LZMA compression in distutils.
parent
2ce0b4fa
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
62 deletions
+121
-62
archive_util.py
archive_util.py
+12
-9
command/bdist.py
command/bdist.py
+2
-1
command/bdist_dumb.py
command/bdist_dumb.py
+2
-1
tests/test_archive_util.py
tests/test_archive_util.py
+104
-50
tests/test_bdist.py
tests/test_bdist.py
+1
-1
No files found.
archive_util.py
View file @
766d1fbd
...
...
@@ -57,26 +57,28 @@ def make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "
compress", "bzip2", or None.
(compress
will be deprecated in Python 3.2)
'compress' must be "gzip" (the default), "
bzip2", "xz", "compress", or
None. ("compress"
will be deprecated in Python 3.2)
'owner' and 'group' can be used to define an owner and a group for the
archive that is being built. If not provided, the current owner and group
will be used.
The output tar file will be named 'base_dir' + ".tar", possibly plus
the appropriate compression extension (".gz", ".bz2" or ".Z").
the appropriate compression extension (".gz", ".bz2"
, ".xz"
or ".Z").
Returns the output filename.
"""
tar_compression
=
{
'gzip'
:
'gz'
,
'bzip2'
:
'bz2'
,
None
:
''
,
'compress'
:
''
}
compress_ext
=
{
'gzip'
:
'.gz'
,
'bzip2'
:
'.bz2'
,
'compress'
:
'.Z'
}
tar_compression
=
{
'gzip'
:
'gz'
,
'bzip2'
:
'bz2'
,
'xz'
:
'xz'
,
None
:
''
,
'compress'
:
''
}
compress_ext
=
{
'gzip'
:
'.gz'
,
'bzip2'
:
'.bz2'
,
'xz'
:
'.xz'
,
'compress'
:
'.Z'
}
# flags for compression program, each element of list will be an argument
if
compress
is
not
None
and
compress
not
in
compress_ext
.
keys
():
raise
ValueError
(
"bad value for 'compress': must be None, 'gzip', 'bzip2' "
"or 'compress'"
)
"bad value for 'compress': must be None, 'gzip', 'bzip2'
,
"
"
'xz'
or 'compress'"
)
archive_name
=
base_name
+
'.tar'
if
compress
!=
'compress'
:
...
...
@@ -177,6 +179,7 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):
ARCHIVE_FORMATS
=
{
'gztar'
:
(
make_tarball
,
[(
'compress'
,
'gzip'
)],
"gzip'ed tar-file"
),
'bztar'
:
(
make_tarball
,
[(
'compress'
,
'bzip2'
)],
"bzip2'ed tar-file"
),
'xztar'
:
(
make_tarball
,
[(
'compress'
,
'xz'
)],
"xz'ed tar-file"
),
'ztar'
:
(
make_tarball
,
[(
'compress'
,
'compress'
)],
"compressed tar file"
),
'tar'
:
(
make_tarball
,
[(
'compress'
,
None
)],
"uncompressed tar file"
),
'zip'
:
(
make_zipfile
,
[],
"ZIP file"
)
...
...
@@ -197,8 +200,8 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
"""Create an archive file (eg. zip or tar).
'base_name' is the name of the file to create, minus any format-specific
extension; 'format' is the archive format: one of "zip", "tar", "ztar",
or "g
ztar".
extension; 'format' is the archive format: one of "zip", "tar", "
g
ztar",
"bztar", "xztar", or "
ztar".
'root_dir' is a directory that will be the root directory of the
archive; ie. we typically chdir into 'root_dir' before creating the
...
...
command/bdist.py
View file @
766d1fbd
...
...
@@ -61,13 +61,14 @@ class bdist(Command):
'nt'
:
'zip'
}
# Establish the preferred order (for the --help-formats option).
format_commands
=
[
'rpm'
,
'gztar'
,
'bztar'
,
'ztar'
,
'tar'
,
format_commands
=
[
'rpm'
,
'gztar'
,
'bztar'
,
'
xztar'
,
'
ztar'
,
'tar'
,
'wininst'
,
'zip'
,
'msi'
]
# And the real information.
format_command
=
{
'rpm'
:
(
'bdist_rpm'
,
"RPM distribution"
),
'gztar'
:
(
'bdist_dumb'
,
"gzip'ed tar file"
),
'bztar'
:
(
'bdist_dumb'
,
"bzip2'ed tar file"
),
'xztar'
:
(
'bdist_dumb'
,
"xz'ed tar file"
),
'ztar'
:
(
'bdist_dumb'
,
"compressed tar file"
),
'tar'
:
(
'bdist_dumb'
,
"tar file"
),
'wininst'
:
(
'bdist_wininst'
,
...
...
command/bdist_dumb.py
View file @
766d1fbd
...
...
@@ -22,7 +22,8 @@ class bdist_dumb(Command):
"platform name to embed in generated filenames "
"(default: %s)"
%
get_platform
()),
(
'format='
,
'f'
,
"archive format to create (tar, ztar, gztar, zip)"
),
"archive format to create (tar, gztar, bztar, xztar, "
"ztar, zip)"
),
(
'keep-temp'
,
'k'
,
"keep the pseudo-installation tree around after "
+
"creating the distribution archive"
),
...
...
tests/test_archive_util.py
View file @
766d1fbd
This diff is collapsed.
Click to expand it.
tests/test_bdist.py
View file @
766d1fbd
...
...
@@ -21,7 +21,7 @@ class BuildTestCase(support.TempdirManager,
# what formats does bdist offer?
formats
=
[
'bztar'
,
'gztar'
,
'msi'
,
'rpm'
,
'tar'
,
'wininst'
,
'zip'
,
'ztar'
]
'wininst'
,
'
xztar'
,
'
zip'
,
'ztar'
]
found
=
sorted
(
cmd
.
format_command
)
self
.
assertEqual
(
found
,
formats
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment