py7zr icon indicating copy to clipboard operation
py7zr copied to clipboard

pack_7zarchive doesn't cd into root_dir and doesn't abide dry_run

Open raffaem opened this issue 2 years ago • 4 comments

I'm using the following code.

outdbfp is a pathlib.WindowsPath of the file I want to compress. Its value is of the form MYPATH\db.sqlite3.

outdbzip is a pathlib.WindowsPath of the output file I want. Its value is of the form MYPATH\db.7z.

Notice the two files are on the same directory.

shutil.register_archive_format('7zip', py7zr.pack_7zarchive, description='7zip archive')
shutil.make_archive (
    outdbzip.stem,
    '7zip',
    root_dir=outdbzip.parent,
    base_dir=outdbfp.name,
    logger=logging.getLogger(),
    dry_run=True
)

However there are 2 problems:

  1. py7zr doesn't seem to cd into root_dir. I have to provide base_dir=outdbfp otherwise it will way that the file does not exist.
  2. dry_run=True seems to be ignored, as py7zr starts right away

raffaem avatar Feb 07 '22 06:02 raffaem

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Jul 18 '22 00:07 github-actions[bot]

Py7zr core does not have a feature of dry_run, so pack_7zarchive cannot support dry_run.

miurahr avatar Jul 18 '22 13:07 miurahr

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Oct 17 '22 00:10 github-actions[bot]

Same issue also on unpack_7zarchive

miurahr avatar Oct 18 '22 13:10 miurahr