Skip to content

Commit

Permalink
Merge https://github.com/pypa/distutils into feature/distutils-7283751
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 15, 2024
2 parents ffdf0bd + 378984e commit ce01828
Show file tree
Hide file tree
Showing 27 changed files with 180 additions and 2,116 deletions.
58 changes: 0 additions & 58 deletions setuptools/_distutils/_collections.py

This file was deleted.

73 changes: 0 additions & 73 deletions setuptools/_distutils/_functools.py

This file was deleted.

52 changes: 0 additions & 52 deletions setuptools/_distutils/_itertools.py

This file was deleted.

3 changes: 2 additions & 1 deletion setuptools/_distutils/_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import functools
import os.path

from ._functools import splat
from jaraco.functools import splat

from .compat.py39 import zip_strict
from .errors import DistutilsFileError

Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _get_vc_env(plat_spec):
stderr=subprocess.STDOUT,
).decode('utf-16le', errors='replace')
except subprocess.CalledProcessError as exc:
log.error(exc.output) # noqa: RUF100, TRY400
log.error(exc.output)
raise DistutilsPlatformError(f"Error executing {exc.cmd}")

env = {
Expand Down
26 changes: 4 additions & 22 deletions setuptools/_distutils/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
that sort of thing)."""

import os
import sys
from warnings import warn

try:
import zipfile
Expand Down Expand Up @@ -67,8 +65,7 @@ def make_tarball(
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or
None. ("compress" will be deprecated in Python 3.2)
'compress' must be "gzip" (the default), "bzip2", "xz", or None.
'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
Expand All @@ -84,20 +81,17 @@ def make_tarball(
'bzip2': 'bz2',
'xz': 'xz',
None: '',
'compress': '',
}
compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz', 'compress': '.Z'}
compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz'}

# 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', "
"'xz' or 'compress'"
"bad value for 'compress': must be None, 'gzip', 'bzip2', 'xz'"
)

archive_name = base_name + '.tar'
if compress != 'compress':
archive_name += compress_ext.get(compress, '')
archive_name += compress_ext.get(compress, '')

mkpath(os.path.dirname(archive_name), dry_run=dry_run)

Expand Down Expand Up @@ -125,18 +119,6 @@ def _set_uid_gid(tarinfo):
finally:
tar.close()

# compression using `compress`
if compress == 'compress':
warn("'compress' is deprecated.", DeprecationWarning)
# the option varies depending on the platform
compressed_name = archive_name + compress_ext[compress]
if sys.platform == 'win32':
cmd = [compress, archive_name, compressed_name]
else:
cmd = [compress, '-f', archive_name]
spawn(cmd, dry_run=dry_run)
return compressed_name

return archive_name


Expand Down
Loading

0 comments on commit ce01828

Please sign in to comment.