Assorted tar related things, including a fast tar-based copy.
*Latest release 20240318*:
Initial PyPI release with nice traced_cpdir() function.
My most heavily used use for this is my `cpdir` script which
does a high performance directory copy by piping 2 `tar`s
together.
It runs this:
from cs.tarutils import traced_cpdir
sys.exit(traced_cpdir(*sys.argv[1:]))
## Function `tar(*srcpaths: List[str], chdirpath='.', output, tar_exe='tar', bcount=2048)`
Tar up the contents of `srcpaths` to `output`.
Return the `Popen` object for the `tar` command.
Parameters:
* `srcpaths`: source filesystem paths
* `chdirpath`: optional directory to which to `chdir` before accessing `srcpaths`
* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`
* `bcount`: blocking factor in 512 byte unites,
default from `DEFAULT_BCOUNT`: `2048`
## Function `traced_cpdir(srcdirpath, dstdirpath, *, label=None, tar_exe='tar', bcount=2048, upd)`
Copy a directory to a new place using piped tars with progress reporting.
Return `0` if both tars succeed, nonzero otherwise.
Parameters:
* `srcdirpath`: the source directory filesystem path
* `dstdirpath`: the destination directory filesystem path,
which must not already exist
* `label`: optional label for the progress bar
* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`
* `bcount`: blocking factor in 512 byte unites,
default from `DEFAULT_BCOUNT`: `2048`
## Function `traced_untar(tarfd, *, chdirpath='.', label=None, tar_exe='tar', bcount=2048, total=None, _stat_fd=False, upd)`
Read tar data from `tarfd` and extract.
Return the `tar` exit code.
Parameters:
* `tarfd`: the source tar data,
suitable for `subprocess.Popen`'s `stdin` parameter
* `chdirpath`: optional directory to which to `chdir` before accessing `srcpaths`
* `label`: optional label for the progress bar
* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`
* `bcount`: blocking factor in 512 byte unites,
default from `DEFAULT_BCOUNT`: `2048`
# Release Log
*Release 20240318*:
Initial PyPI release with nice traced_cpdir() function.
Raw data
{
"_id": null,
"home_page": "",
"name": "cs.tarutils",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python3",
"author": "",
"author_email": "Cameron Simpson <cs@cskk.id.au>",
"download_url": "https://files.pythonhosted.org/packages/57/12/f48e1201bbb7923a18b4f22b4be4d99297c152979f97bbb5d73d71a6483c/cs.tarutils-20240318.tar.gz",
"platform": null,
"description": "Assorted tar related things, including a fast tar-based copy.\n\n*Latest release 20240318*:\nInitial PyPI release with nice traced_cpdir() function.\n\nMy most heavily used use for this is my `cpdir` script which\ndoes a high performance directory copy by piping 2 `tar`s\ntogether.\nIt runs this:\n\n from cs.tarutils import traced_cpdir\n sys.exit(traced_cpdir(*sys.argv[1:]))\n\n## Function `tar(*srcpaths: List[str], chdirpath='.', output, tar_exe='tar', bcount=2048)`\n\nTar up the contents of `srcpaths` to `output`.\nReturn the `Popen` object for the `tar` command.\n\nParameters:\n* `srcpaths`: source filesystem paths\n* `chdirpath`: optional directory to which to `chdir` before accessing `srcpaths`\n* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`\n* `bcount`: blocking factor in 512 byte unites,\n default from `DEFAULT_BCOUNT`: `2048`\n\n## Function `traced_cpdir(srcdirpath, dstdirpath, *, label=None, tar_exe='tar', bcount=2048, upd)`\n\nCopy a directory to a new place using piped tars with progress reporting.\nReturn `0` if both tars succeed, nonzero otherwise.\n\nParameters:\n* `srcdirpath`: the source directory filesystem path\n* `dstdirpath`: the destination directory filesystem path,\n which must not already exist\n* `label`: optional label for the progress bar\n* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`\n* `bcount`: blocking factor in 512 byte unites,\n default from `DEFAULT_BCOUNT`: `2048`\n\n## Function `traced_untar(tarfd, *, chdirpath='.', label=None, tar_exe='tar', bcount=2048, total=None, _stat_fd=False, upd)`\n\nRead tar data from `tarfd` and extract.\nReturn the `tar` exit code.\n\nParameters:\n* `tarfd`: the source tar data,\n suitable for `subprocess.Popen`'s `stdin` parameter\n* `chdirpath`: optional directory to which to `chdir` before accessing `srcpaths`\n* `label`: optional label for the progress bar\n* `tar_exe`: optional `tar` executable, default from `TAR_EXE`: `tar`\n* `bcount`: blocking factor in 512 byte unites,\n default from `DEFAULT_BCOUNT`: `2048`\n\n# Release Log\n\n\n\n*Release 20240318*:\nInitial PyPI release with nice traced_cpdir() function.\n\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 or later (GPLv3+)",
"summary": "Assorted tar related things, including a fast tar-based copy.",
"version": "20240318",
"project_urls": {
"URL": "https://bitbucket.org/cameron_simpson/css/commits/all"
},
"split_keywords": [
"python3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c17c20665757b8d3253b64bd55313ef638a51f5a2ec939a7cc06ff86855bef9",
"md5": "91219db4a5d0a5a99c445952ea2774a1",
"sha256": "6829df016051a16e4cefd9b39a4edff35b3e88585f70081b4995b75567b25180"
},
"downloads": -1,
"filename": "cs.tarutils-20240318-py3-none-any.whl",
"has_sig": false,
"md5_digest": "91219db4a5d0a5a99c445952ea2774a1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5436,
"upload_time": "2024-03-17T23:33:53",
"upload_time_iso_8601": "2024-03-17T23:33:53.318768Z",
"url": "https://files.pythonhosted.org/packages/4c/17/c20665757b8d3253b64bd55313ef638a51f5a2ec939a7cc06ff86855bef9/cs.tarutils-20240318-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5712f48e1201bbb7923a18b4f22b4be4d99297c152979f97bbb5d73d71a6483c",
"md5": "c9505f2b1cf3397164373f9a01715263",
"sha256": "94970061d5dae7d4894a808082e5d8e36e64a357ddb4c914b0174fbbb6e255e9"
},
"downloads": -1,
"filename": "cs.tarutils-20240318.tar.gz",
"has_sig": false,
"md5_digest": "c9505f2b1cf3397164373f9a01715263",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5173,
"upload_time": "2024-03-17T23:33:55",
"upload_time_iso_8601": "2024-03-17T23:33:55.337358Z",
"url": "https://files.pythonhosted.org/packages/57/12/f48e1201bbb7923a18b4f22b4be4d99297c152979f97bbb5d73d71a6483c/cs.tarutils-20240318.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-17 23:33:55",
"github": false,
"gitlab": false,
"bitbucket": true,
"codeberg": false,
"bitbucket_user": "cameron_simpson",
"bitbucket_project": "css",
"lcname": "cs.tarutils"
}