Commit Graph

18 Commits (42112060b59655830ddc70895d40bf74d3991a14)

Author SHA1 Message Date
Ben Doherty 42112060b5 Rename 'archive' -> 'arcfile' in compress branch 2016-12-08 11:34:37 -05:00
Ben Doherty b0211c72d7 Change 'creates' parameter to 'dest' 2016-12-08 11:34:37 -05:00
Ben Doherty fb03fc8eb1 Refactor zip and tarfile loops together, branch where calls are different
This fixed a few bugs and simplified the code
2016-12-08 11:34:37 -05:00
Benjamin Doherty 8fc2a22b4c Add 'default' to docs for 'compression' option 2016-12-08 11:34:37 -05:00
Ben Doherty 102ee6a3b4 Some refactoring:
* rename archive -> arcfile (where it's a file descriptor)
* additional return
* simplify logic around 'archive?' flag
* maintain os separator after arcroot
* use function instead of lambda for filter, ensure file exists before file.cmp'ing it
* track errored files and fail if there are any
2016-12-08 11:34:36 -05:00
Ben Doherty d4b51adf72 Reword comments slightly 2016-12-08 11:34:36 -05:00
Ben Doherty e10e1e358c Documentation updates 2016-12-08 11:34:36 -05:00
Ben Doherty 506f3f68f1 Use different syntax in lambda 2016-12-08 11:34:36 -05:00
Ben Doherty c9291e06f6 Make remove default to false. It's less frightening. 2016-12-08 11:34:36 -05:00
Ben Doherty 3c8d788c11 Don't use <x> if <y> else <z> syntax 2016-12-08 11:34:36 -05:00
Ben Doherty c5b9bda656 Accept 'path' as a list argument, expose path and expanded_path,
Use correct variable in expanduser
2016-12-08 11:34:36 -05:00
Ben Doherty 2aa3f52bf3 Fix up for zip files and nesting logic.
* Don't include the archive in the archive if it falls within an archived path
* If remove=True and the archive would be in an archived path, fail.
* Fix single-file zip file compression
* Add more documentation about 'state' return
2016-12-08 11:34:36 -05:00
Ben Doherty 3be65b66d1 Add license 2016-12-08 11:34:36 -05:00
Ben Doherty 90fdc71728 Add compressed file source to successes when succeeds! 2016-12-08 11:34:36 -05:00
Ben Doherty bab1f5c082 Add RETURN documentation 2016-12-08 11:34:36 -05:00
Ben Doherty 409f67584e Fix write mode for ZipFiles ('wb' is invalid!) 2016-12-08 11:34:36 -05:00
Ben Doherty 3465375e42 Drop extra double-quote from documentation 2016-12-08 11:34:36 -05:00
Ben Doherty 2e1ce01dff Initial commit of extras/archive module.
This manages compressed files or archives of many compressed files. You can maintain or update .gz, .bz2 compressed files, .zip archives, or tarballs compressed with gzip or bzip2.

Possible use cases:

* Back up user home directories
* Ensure large text files are always compressed
* Archive trees for distribution
2016-12-08 11:34:36 -05:00