Skip to content

Commit 7cc8eda

Browse files
committed
Remove scancode references in temp dir names #2233
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent f18293d commit 7cc8eda

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/extractcode/archive.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def extract_twice(location, target_dir, extractor1, extractor2):
332332
abs_location = os.path.abspath(os.path.expanduser(location))
333333
abs_target_dir = compat.unicode(os.path.abspath(os.path.expanduser(target_dir)))
334334
# extract first the intermediate payload to a temp dir
335-
temp_target = compat.unicode(fileutils.get_temp_dir(prefix='scancode-extract-'))
335+
temp_target = compat.unicode(fileutils.get_temp_dir(prefix='extractcode-extract-'))
336336
warnings = extractor1(abs_location, temp_target)
337337
if TRACE:
338338
logger.debug('extract_twice: temp_target: %(temp_target)r' % locals())
@@ -366,15 +366,15 @@ def extract_with_fallback(location, target_dir, extractor1, extractor2):
366366
abs_location = os.path.abspath(os.path.expanduser(location))
367367
abs_target_dir = compat.unicode(os.path.abspath(os.path.expanduser(target_dir)))
368368
# attempt extract first to a temp dir
369-
temp_target1 = compat.unicode(fileutils.get_temp_dir(prefix='scancode-extract1-'))
369+
temp_target1 = compat.unicode(fileutils.get_temp_dir(prefix='extractcode-extract1-'))
370370
try:
371371
warnings = extractor1(abs_location, temp_target1)
372372
if TRACE:
373373
logger.debug('extract_with_fallback: temp_target1: %(temp_target1)r' % locals())
374374
fileutils.copytree(temp_target1, abs_target_dir)
375375
except:
376376
try:
377-
temp_target2 = compat.unicode(fileutils.get_temp_dir(prefix='scancode-extract2-'))
377+
temp_target2 = compat.unicode(fileutils.get_temp_dir(prefix='extractcode-extract2-'))
378378
warnings = extractor2(abs_location, temp_target2)
379379
if TRACE:
380380
logger.debug('extract_with_fallback: temp_target2: %(temp_target2)r' % locals())
@@ -396,7 +396,7 @@ def try_to_extract(location, target_dir, extractor):
396396
"""
397397
abs_location = os.path.abspath(os.path.expanduser(location))
398398
abs_target_dir = compat.unicode(os.path.abspath(os.path.expanduser(target_dir)))
399-
temp_target = compat.unicode(fileutils.get_temp_dir(prefix='scancode-extract1-'))
399+
temp_target = compat.unicode(fileutils.get_temp_dir(prefix='extractcode-extract1-'))
400400
warnings = []
401401
try:
402402
warnings = extractor(abs_location, temp_target)

src/extractcode/extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def extract_file(
243243
try:
244244
# extract first to a temp directory: if there is an error, the
245245
# extracted files will not be moved to target
246-
tmp_tgt = fileutils.get_temp_dir(prefix='scancode-extract-')
246+
tmp_tgt = fileutils.get_temp_dir(prefix='extractcode-extract-')
247247
abs_location = abspath(expanduser(location))
248248
warns = extractor(abs_location, tmp_tgt) or []
249249
warnings.extend(warns)

src/extractcode/sevenzip.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@
5050
from extractcode import ExtractWarningIncorrectEntry
5151

5252
if py3:
53-
from shlex import quote as shlex_quote
53+
from shlex import quote as shlex_quote # NOQA
5454
else:
55-
from pipes import quote as shlex_quote
55+
from pipes import quote as shlex_quote # NOQA
56+
5657

5758
"""
5859
Low level support for p/7zip-based archive extraction.
@@ -375,7 +376,7 @@ def extract_file_by_file(location, target_dir, arch_type='*', skip_symlinks=True
375376

376377
errors = {}
377378
warnings = {}
378-
tmp_dir = fileutils.get_temp_dir(prefix='scancode-7zip-')
379+
tmp_dir = fileutils.get_temp_dir(prefix='extractcode-extract-')
379380
for i, entry in enumerate(entries):
380381

381382
if not entry.is_file:
@@ -617,7 +618,7 @@ def parse_7z_listing(location, utf=False):
617618
second_line = lines.pop(1)
618619
first_line = line_sep.join([first_line, second_line])
619620
lines[0] = first_line
620-
621+
621622
dangling_lines = [line for line in lines if kv_sep not in line]
622623
entry_errors = []
623624
if dangling_lines:
@@ -673,7 +674,7 @@ class Entry(object):
673674

674675
def to_dict(self, full=False):
675676
data = attr.asdict(self)
676-
#data.pop('errors', None)
677+
# data.pop('errors', None)
677678
if not full:
678679
data.pop('date', None)
679680
return data

src/extractcode/uncompress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def uncompress_file(location, decompressor):
8686

8787
warnings = []
8888
base_name = fileutils.file_base_name(location)
89-
target_location = os.path.join(fileutils.get_temp_dir(prefix='scancode-extract-'), base_name)
89+
target_location = os.path.join(fileutils.get_temp_dir(prefix='extractcode-extract-'), base_name)
9090
with decompressor(location, 'rb') as compressed:
9191
with open(target_location, 'wb') as uncompressed:
9292
buffer_size = 32 * 1024 * 1024

0 commit comments

Comments
 (0)