mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
fix: use tarfile filter
This commit is contained in:
1 parent
460b07a4c5
commit
1bbc99100a
1 file changed
+8
-15
+8
-15
@@ -9,6 +9,11 @@ from concat_licenses import concat_license
|
|||||||
from parse_toml import get_entrypoint
|
from parse_toml import get_entrypoint
|
||||||
from prebuild import get_pyapp, rebuild_cpython
|
from prebuild import get_pyapp, rebuild_cpython
|
||||||
|
|
||||||
|
def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
|
||||||
|
info.uname = "dzgui"
|
||||||
|
info.gname = "users"
|
||||||
|
return info
|
||||||
|
|
||||||
root = Path(__file__).resolve().parents[1]
|
root = Path(__file__).resolve().parents[1]
|
||||||
output = root.joinpath("dist")
|
output = root.joinpath("dist")
|
||||||
build_dir = root.joinpath("build")
|
build_dir = root.joinpath("build")
|
||||||
@@ -60,30 +65,18 @@ if proc.returncode == 0:
|
|||||||
release_exe = subfolder.joinpath(appname)
|
release_exe = subfolder.joinpath(appname)
|
||||||
output_exe.rename(release_exe)
|
output_exe.rename(release_exe)
|
||||||
tarpath = output.joinpath(tarname)
|
tarpath = output.joinpath(tarname)
|
||||||
|
|
||||||
with tarfile.open(tarpath, "w:gz") as tar:
|
with tarfile.open(tarpath, "w:gz") as tar:
|
||||||
info = tar.gettarinfo(subfolder)
|
info = tar.gettarinfo(subfolder)
|
||||||
info.type = tarfile.DIRTYPE
|
tar.add(subfolder, arcname="dzgui", filter=update_uname)
|
||||||
info.uname = appname
|
|
||||||
info.name = appname
|
|
||||||
#with open(subfolder, "rb") as f:
|
|
||||||
# tar.add(info, f)
|
|
||||||
|
|
||||||
tar.add(subfolder, arcname="dzgui")
|
|
||||||
|
|
||||||
#for file in subfolder.iterdir():
|
|
||||||
# info = tar.gettarinfo(file)
|
|
||||||
# info.uname = appname
|
|
||||||
# info.name = appname
|
|
||||||
# with open(file, "rb") as f:
|
|
||||||
# tar.addfile(info, f)
|
|
||||||
print(f"Wrote tarfile to '{tarpath}'")
|
print(f"Wrote tarfile to '{tarpath}'")
|
||||||
|
|
||||||
proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
||||||
assert proc.stdout.rstrip() == version
|
assert proc.stdout.rstrip() == version
|
||||||
|
|
||||||
|
# TODO: clean up staging directory
|
||||||
release_exe.unlink()
|
release_exe.unlink()
|
||||||
license_file.unlink()
|
license_file.unlink()
|
||||||
subfolder.rmdir()
|
subfolder.rmdir()
|
||||||
Path(wheel).unlink()
|
Path(wheel).unlink()
|
||||||
|
|
||||||
# TODO: clean up staging directory
|
|
||||||
Reference in new issue
Block a user