Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions dtrx/dtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,10 @@ def get_filenames(self):

class SevenExtractor(NoPipeExtractor):
file_type = "7z file"
list_command = ["7z", "l"]
list_command = ["7z", "l", "-ba"]
border_re = re.compile("^[- ]+$")
extract_command = ["7z", "x"]
space_re = re.compile(" ")

@property
def extract_command(self):
Expand All @@ -727,15 +729,10 @@ def extract_command(self):
return cmd

def get_filenames(self):
fn_index = None
for line in NoPipeExtractor.get_filenames(self):
if self.border_re.match(line):
if fn_index is not None:
break
else:
fn_index = string.rindex(line, " ") + 1
elif fn_index is not None:
yield line[fn_index:]
if " " in line:
pos = line.rindex(" ") + 1
yield line[pos:]
self.archive.close()

def send_stdout_to_dev_null(self):
Expand Down Expand Up @@ -767,7 +764,7 @@ def get_filenames(self):
if fn_index is not None:
break
else:
fn_index = string.rindex(line, " ") + 1
fn_index = line.rindex(" ") + 1
elif fn_index is not None:
yield line[fn_index:]
self.archive.close()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ build==0.8.0
docutils==0.16
invoke==1.7.1
pre-commit==2.20.0
pyyaml==5.4.1
pyyaml==5.3.1
tox==3.26.0
tox-pyenv==1.1.0
13 changes: 13 additions & 0 deletions tests/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@
a/b
foobar

- name: list contents of 7z
options: -n -l
filenames: test-1.23.7z
output: |
test-1.23.7z:
test-1.23/1/2/3
test-1.23/a/b
test-1.23/foobar
test-1.23/a
test-1.23/1/2
test-1.23/1
test-1.23

- name: list contents of .arj
options: -n -l
filenames: test-1.23.arj
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ envlist = py27, py37, py38, py39, py3.10, py3.11
whitelist_externals =
/bin/bash
deps =
pyyaml==5.4.1
pyyaml==5.3.1
setenv =
TOX_INI_DIR = {toxinidir}
commands =
Expand Down