@@ -619,23 +619,23 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
619619
620620 Create an archive file (such as zip or tar) and return its name.
621621
622- *base_name * is the :term: `path-like object ` specifying the name of the file
623- to create, including the path, minus any format-specific extension.
622+ *base_name * is a string or :term: `path-like object ` specifying the name of
623+ the file to create, including the path, minus any format-specific extension.
624624
625625 *format * is the archive format: one of
626626 "zip" (if the :mod: `zlib ` module is available), "tar", "gztar" (if the
627627 :mod: `zlib ` module is available), "bztar" (if the :mod: `bz2 ` module is
628628 available), "xztar" (if the :mod: `lzma ` module is available), or "zstdtar"
629629 (if the :mod: `compression.zstd ` module is available).
630630
631- *root_dir * is the :term: `path-like object ` specifying a directory that will
632- be the root directory of the archive, all paths in the archive will be
633- relative to it; for example, we typically chdir into *root_dir * before
634- creating the archive.
631+ *root_dir * is a string or :term: `path-like object ` specifying a directory
632+ that will be the root directory of the archive, all paths in the archive
633+ will be relative to it; for example, we typically chdir into *root_dir *
634+ before creating the archive.
635635
636- *base_dir * is the :term: `path-like object ` specifying a directory where we
637- start archiving from; i.e. *base_dir * will be the common prefix of all files
638- and directories in the archive. *base_dir * must be given relative
636+ *base_dir * is a string or :term: `path-like object ` specifying a directory
637+ where we start archiving from; i.e. *base_dir * will be the common prefix of
638+ all files and directories in the archive. *base_dir * must be given relative
639639 to *root_dir *. See :ref: `shutil-archiving-example-with-basedir ` for how to
640640 use *base_dir * and *root_dir * together.
641641
@@ -670,8 +670,9 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
670670 This function is now made thread-safe during creation of standard
671671 ``.zip `` and tar archives.
672672
673- .. versionchanged :: 3.15
674- Accepts a :term: `path-like object ` for *base_name *.
673+ .. versionchanged :: next
674+ Accepts a :term: `path-like object ` for *base_name *, *root_dir * and
675+ *base_dir *.
675676
676677.. function :: get_archive_formats()
677678
@@ -818,10 +819,10 @@ Archiving example
818819In this example, we create a gzip'ed tar-file archive containing all files
819820found in the :file: `.ssh ` directory of the user::
820821
821- >>> from pathlib import Path
822822 >>> from shutil import make_archive
823- >>> archive_name = Path.home() / 'myarchive'
824- >>> root_dir = Path.home() / '.ssh'
823+ >>> import os
824+ >>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))
825+ >>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))
825826 >>> make_archive(archive_name, 'gztar', root_dir)
826827 '/Users/tarek/myarchive.tar.gz'
827828
@@ -862,9 +863,9 @@ we show how to use :func:`make_archive`, but this time with the usage of
862863 In the final archive, :file: `please_add.txt ` should be included, but
863864:file: `do_not_add.txt ` should not. Therefore we use the following::
864865
865- >>> from pathlib import Path
866866 >>> from shutil import make_archive
867- >>> archive_name = Path.home() / 'myarchive'
867+ >>> import os
868+ >>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))
868869 >>> make_archive(
869870 ... archive_name,
870871 ... 'tar',
0 commit comments