fix out_path handling

This commit is contained in:
Q
2024-06-26 23:00:02 +03:00
parent 8be7630c77
commit 1bae716f07
2 changed files with 15 additions and 3 deletions

View File

@@ -7,6 +7,11 @@ build() {
echo "copy dist/ to six9.net/py/qgpg/"
}
setup_useve() {
set -e
. useve-runner
useve mk qgpg
}
install_useve() {
set -e
@@ -32,6 +37,7 @@ test_encrypt() {
@ qgpg --key key2.pub e datadir/folder1/1testfile datadir/1testfile.encrypted.gpg
@ qgpg --key key2.pub -r e datadir
@ qgpg --key key2.pub -r e datadir
@ qgpg --key key2.pub -r e $(pwd)/datadir/ datadir.encrypted/
@ hash-update -t sha1 -f sha1sum.txt -r datadir
}
@@ -47,7 +53,7 @@ test_decrypt() {
install_without_tools() {
python3 -m venv .local/share/qgpg
.local/share/qgpg/bin/pip install -U pip https://six9.net/py/qgpg/qgpg-1.0.tar.gz
.local/share/qgpg/bin/pip install -U pip https://six9.net/py/qgpg/qgpg-1.0.tar.gz
mkdir -p .local/bin
ln -sfT ~/.local/share/qgpg/bin/qgpg .local/bin/qgpg

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
__version__ = "1.1"
__version__ = "1.1.1"
import argparse
import os
@@ -260,7 +260,7 @@ class Processor:
if self.opts.command == "decrypt":
auto_path = in_file[: -len(self.suffix)]
if self.opts.recursive and self.opts.out_path:
out_file = os.path.join(self.opts.out_path, os.sep.join(auto_path.split(os.sep)[1:]))
out_file = os.path.join(self.opts.out_path, strip_prefix(auto_path, self.opts.path))
os.makedirs(os.path.dirname(out_file), exist_ok=True)
else:
out_file = self.opts.out_path if self.opts.out_path else auto_path
@@ -288,6 +288,12 @@ class Processor:
sys.exit(1)
def strip_prefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix) :]
return s[:]
def main():
Processor()