miurahr / py7zr

7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.

Home Page:https://pypi.org/project/py7zr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

raffaem opened this issue · 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

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

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

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

Same issue also on unpack_7zarchive