PyFoxFile 0.21.2__py3-none-any.whl → 0.21.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfoxfile-0.21.2.data → pyfoxfile-0.21.4.data}/scripts/foxfile.py +1 -1
- {pyfoxfile-0.21.2.data → pyfoxfile-0.21.4.data}/scripts/neofoxfile.py +1 -1
- {pyfoxfile-0.21.2.dist-info → pyfoxfile-0.21.4.dist-info}/METADATA +4 -4
- pyfoxfile-0.21.4.dist-info/RECORD +10 -0
- pyfoxfile.py +282 -187
- pyfoxfile-0.21.2.dist-info/RECORD +0 -10
- {pyfoxfile-0.21.2.data → pyfoxfile-0.21.4.data}/scripts/foxneofile.py +0 -0
- {pyfoxfile-0.21.2.dist-info → pyfoxfile-0.21.4.dist-info}/WHEEL +0 -0
- {pyfoxfile-0.21.2.dist-info → pyfoxfile-0.21.4.dist-info}/licenses/LICENSE +0 -0
- {pyfoxfile-0.21.2.dist-info → pyfoxfile-0.21.4.dist-info}/top_level.txt +0 -0
- {pyfoxfile-0.21.2.dist-info → pyfoxfile-0.21.4.dist-info}/zip-safe +0 -0
pyfoxfile.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
15
|
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
16
|
|
|
17
|
-
$FileInfo: pyfoxfile.py - Last Update: 8/
|
|
17
|
+
$FileInfo: pyfoxfile.py - Last Update: 8/26/2025 Ver. 0.21.4 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
|
|
@@ -32,10 +32,12 @@ import socket
|
|
|
32
32
|
import hashlib
|
|
33
33
|
import inspect
|
|
34
34
|
import datetime
|
|
35
|
+
import tempfile
|
|
35
36
|
import logging
|
|
36
37
|
import zipfile
|
|
37
38
|
import binascii
|
|
38
39
|
import platform
|
|
40
|
+
from io import StringIO, BytesIO
|
|
39
41
|
try:
|
|
40
42
|
from backports import tempfile
|
|
41
43
|
except ImportError:
|
|
@@ -243,17 +245,6 @@ except ImportError:
|
|
|
243
245
|
from urllib2 import Request, build_opener, HTTPBasicAuthHandler
|
|
244
246
|
from urlparse import urlparse
|
|
245
247
|
|
|
246
|
-
# StringIO and BytesIO
|
|
247
|
-
try:
|
|
248
|
-
from io import StringIO, BytesIO
|
|
249
|
-
except ImportError:
|
|
250
|
-
try:
|
|
251
|
-
from cStringIO import StringIO
|
|
252
|
-
from cStringIO import StringIO as BytesIO
|
|
253
|
-
except ImportError:
|
|
254
|
-
from StringIO import StringIO
|
|
255
|
-
from StringIO import StringIO as BytesIO
|
|
256
|
-
|
|
257
248
|
def get_importing_script_path():
|
|
258
249
|
# Inspect the stack and get the frame of the caller
|
|
259
250
|
stack = inspect.stack()
|
|
@@ -275,22 +266,6 @@ def get_default_threads():
|
|
|
275
266
|
|
|
276
267
|
|
|
277
268
|
__use_pysftp__ = False
|
|
278
|
-
__use_alt_format__ = False
|
|
279
|
-
__use_env_file__ = True
|
|
280
|
-
__use_ini_file__ = True
|
|
281
|
-
__use_ini_name__ = "foxfile.ini"
|
|
282
|
-
if('PYARCHIVEFILE_CONFIG_FILE' in os.environ and os.path.exists(os.environ['PYARCHIVEFILE_CONFIG_FILE']) and __use_env_file__):
|
|
283
|
-
scriptconf = os.environ['PYARCHIVEFILE_CONFIG_FILE']
|
|
284
|
-
else:
|
|
285
|
-
prescriptpath = get_importing_script_path()
|
|
286
|
-
if(prescriptpath is not None):
|
|
287
|
-
scriptconf = os.path.join(os.path.dirname(prescriptpath), __use_ini_name__)
|
|
288
|
-
else:
|
|
289
|
-
scriptconf = ""
|
|
290
|
-
if os.path.exists(scriptconf):
|
|
291
|
-
__config_file__ = scriptconf
|
|
292
|
-
else:
|
|
293
|
-
__config_file__ = os.path.join(os.path.dirname(os.path.realpath(__file__)), __use_ini_name__)
|
|
294
269
|
if(not havepysftp):
|
|
295
270
|
__use_pysftp__ = False
|
|
296
271
|
__use_http_lib__ = "httpx"
|
|
@@ -328,7 +303,25 @@ def is_only_nonprintable(var):
|
|
|
328
303
|
__file_format_multi_dict__ = {}
|
|
329
304
|
__file_format_default__ = "FoxFile"
|
|
330
305
|
__include_defaults__ = True
|
|
306
|
+
__use_inmemfile__ = False
|
|
331
307
|
__program_name__ = "Py"+__file_format_default__
|
|
308
|
+
__use_env_file__ = True
|
|
309
|
+
__use_ini_file__ = True
|
|
310
|
+
__use_ini_name__ = "foxfile.ini"
|
|
311
|
+
__use_json_file__ = False
|
|
312
|
+
__use_json_name__ = "foxfile.json"
|
|
313
|
+
if('PYARCHIVEFILE_CONFIG_FILE' in os.environ and os.path.exists(os.environ['PYARCHIVEFILE_CONFIG_FILE']) and __use_env_file__):
|
|
314
|
+
scriptconf = os.environ['PYARCHIVEFILE_CONFIG_FILE']
|
|
315
|
+
else:
|
|
316
|
+
prescriptpath = get_importing_script_path()
|
|
317
|
+
if(prescriptpath is not None):
|
|
318
|
+
scriptconf = os.path.join(os.path.dirname(prescriptpath), __use_ini_name__)
|
|
319
|
+
else:
|
|
320
|
+
scriptconf = ""
|
|
321
|
+
if os.path.exists(scriptconf):
|
|
322
|
+
__config_file__ = scriptconf
|
|
323
|
+
else:
|
|
324
|
+
__config_file__ = os.path.join(os.path.dirname(os.path.realpath(__file__)), __use_ini_name__)
|
|
332
325
|
if __use_ini_file__ and os.path.exists(__config_file__):
|
|
333
326
|
config = configparser.ConfigParser()
|
|
334
327
|
config.read(__config_file__)
|
|
@@ -340,6 +333,7 @@ if __use_ini_file__ and os.path.exists(__config_file__):
|
|
|
340
333
|
__file_format_default__ = decode_unicode_escape(config.get('config', 'default'))
|
|
341
334
|
__program_name__ = decode_unicode_escape(config.get('config', 'proname'))
|
|
342
335
|
__include_defaults__ = config.getboolean('config', 'includedef')
|
|
336
|
+
__use_inmemfile__ = config.getboolean('config', 'inmemfile')
|
|
343
337
|
# Loop through all sections
|
|
344
338
|
for section in config.sections():
|
|
345
339
|
required_keys = [
|
|
@@ -389,12 +383,13 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
389
383
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
390
384
|
__project__ = __program_name__
|
|
391
385
|
__project_url__ = "https://github.com/GameMaker2k/PyFoxFile"
|
|
392
|
-
__version_info__ = (0, 21,
|
|
393
|
-
|
|
386
|
+
__version_info__ = (0, 21, 4, "RC 1", 1)
|
|
387
|
+
__version_info__ = (0, 21, 4, "RC 1", 1)
|
|
388
|
+
__version_date_info__ = (2025, 9, 26, "RC 1", 1)
|
|
394
389
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
395
390
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
396
391
|
__revision__ = __version_info__[3]
|
|
397
|
-
__revision_id__ = "$Id:
|
|
392
|
+
__revision_id__ = "$Id: 9911cc0b37bf3b39652ce61ec29c1e2180f46e43 $"
|
|
398
393
|
if(__version_info__[4] is not None):
|
|
399
394
|
__version_date_plusrc__ = __version_date__ + \
|
|
400
395
|
"-" + str(__version_date_info__[4])
|
|
@@ -584,6 +579,105 @@ def VerbosePrintOutReturn(dbgtxt, outtype="log", dbgenable=True, dgblevel=20):
|
|
|
584
579
|
return dbgtxt
|
|
585
580
|
|
|
586
581
|
|
|
582
|
+
# --- Helpers ---
|
|
583
|
+
def _normalize_initial_data(data, isbytes, encoding):
|
|
584
|
+
"""Return data in the correct type for write(): bytes (if isbytes) or text (if not)."""
|
|
585
|
+
if data is None:
|
|
586
|
+
return None
|
|
587
|
+
|
|
588
|
+
if isbytes:
|
|
589
|
+
# Want bytes
|
|
590
|
+
if isinstance(data, bytes):
|
|
591
|
+
return data
|
|
592
|
+
# Py2: str is already bytes, unicode needs encode
|
|
593
|
+
if sys.version_info[0] == 2:
|
|
594
|
+
try:
|
|
595
|
+
unicode # noqa: F821
|
|
596
|
+
except NameError:
|
|
597
|
+
pass
|
|
598
|
+
else:
|
|
599
|
+
if isinstance(data, unicode): # noqa: F821
|
|
600
|
+
return data.encode(encoding)
|
|
601
|
+
# Py3 str -> encode
|
|
602
|
+
return str(data).encode(encoding)
|
|
603
|
+
else:
|
|
604
|
+
# Want text (unicode/str)
|
|
605
|
+
if sys.version_info[0] == 2:
|
|
606
|
+
try:
|
|
607
|
+
unicode # noqa: F821
|
|
608
|
+
if isinstance(data, unicode): # noqa: F821
|
|
609
|
+
return data
|
|
610
|
+
# bytes/str -> decode
|
|
611
|
+
return data.decode(encoding) if isinstance(data, str) else unicode(data) # noqa: F821
|
|
612
|
+
except NameError:
|
|
613
|
+
# Very defensive; shouldn't happen
|
|
614
|
+
return data
|
|
615
|
+
else:
|
|
616
|
+
# Py3: want str
|
|
617
|
+
if isinstance(data, bytes):
|
|
618
|
+
return data.decode(encoding)
|
|
619
|
+
return str(data)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def MkTempFile(data=None, inmem=__use_inmemfile__, isbytes=True, prefix=__project__,
|
|
623
|
+
delete=True, encoding="utf-8"):
|
|
624
|
+
"""
|
|
625
|
+
Return a file-like handle.
|
|
626
|
+
- If inmem=True: returns StringIO (text) or BytesIO (bytes).
|
|
627
|
+
- If inmem=False: returns a NamedTemporaryFile opened in text or binary mode.
|
|
628
|
+
Args:
|
|
629
|
+
data: optional initial content; if provided, it's written and the handle is seek(0)
|
|
630
|
+
inmem: bool — return in-memory handle if True
|
|
631
|
+
isbytes: bool — choose bytes (True) or text (False)
|
|
632
|
+
prefix: str — tempfile prefix
|
|
633
|
+
delete: bool — whether the tempfile is deleted on close (NamedTemporaryFile)
|
|
634
|
+
encoding: str — used for text mode (and for conversions when needed)
|
|
635
|
+
"""
|
|
636
|
+
init = _normalize_initial_data(data, isbytes, encoding)
|
|
637
|
+
|
|
638
|
+
if inmem:
|
|
639
|
+
buf = BytesIO() if isbytes else StringIO()
|
|
640
|
+
if init is not None:
|
|
641
|
+
buf.write(init)
|
|
642
|
+
buf.seek(0)
|
|
643
|
+
return buf
|
|
644
|
+
|
|
645
|
+
mode = "wb+" if isbytes else "w+"
|
|
646
|
+
kwargs = {"prefix": prefix or "", "delete": delete, "mode": mode}
|
|
647
|
+
|
|
648
|
+
# Only Python 3's text-mode files accept encoding/newline explicitly
|
|
649
|
+
if not isbytes and sys.version_info[0] >= 3:
|
|
650
|
+
kwargs["encoding"] = encoding
|
|
651
|
+
kwargs["newline"] = ""
|
|
652
|
+
|
|
653
|
+
f = tempfile.NamedTemporaryFile(**kwargs)
|
|
654
|
+
|
|
655
|
+
if init is not None:
|
|
656
|
+
f.write(init)
|
|
657
|
+
f.seek(0)
|
|
658
|
+
return f
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def MkTempFileSmart(data=None, isbytes=True, prefix=__project__, max_mem=1024*1024, encoding="utf-8"):
|
|
662
|
+
"""
|
|
663
|
+
Spooled temp file: starts in memory and spills to disk past max_mem.
|
|
664
|
+
Behaves like BytesIO/StringIO for small data, with the same preload+seek(0) behavior.
|
|
665
|
+
"""
|
|
666
|
+
mode = "wb+" if isbytes else "w+"
|
|
667
|
+
kwargs = {"mode": mode, "max_size": max_mem, "prefix": prefix or ""}
|
|
668
|
+
if not isbytes and sys.version_info[0] >= 3:
|
|
669
|
+
kwargs["encoding"] = encoding
|
|
670
|
+
kwargs["newline"] = ""
|
|
671
|
+
|
|
672
|
+
f = tempfile.SpooledTemporaryFile(**kwargs)
|
|
673
|
+
|
|
674
|
+
init = _normalize_initial_data(data, isbytes, encoding)
|
|
675
|
+
if init is not None:
|
|
676
|
+
f.write(init)
|
|
677
|
+
f.seek(0)
|
|
678
|
+
return f
|
|
679
|
+
|
|
680
|
+
|
|
587
681
|
def RemoveWindowsPath(dpath):
|
|
588
682
|
"""
|
|
589
683
|
Normalize a path by converting backslashes to forward slashes
|
|
@@ -1920,7 +2014,7 @@ def ReadFileHeaderDataBySize(fp, delimiter=__file_format_dict__['format_delimite
|
|
|
1920
2014
|
headersize = int(preheaderdata[0], 16)
|
|
1921
2015
|
if(headersize <= 0):
|
|
1922
2016
|
return []
|
|
1923
|
-
subfp =
|
|
2017
|
+
subfp = MkTempFile()
|
|
1924
2018
|
subfp.write(fp.read(headersize))
|
|
1925
2019
|
fp.seek(len(delimiter), 1)
|
|
1926
2020
|
subfp.seek(0, 0)
|
|
@@ -2004,7 +2098,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2004
2098
|
return False
|
|
2005
2099
|
fhend = fp.tell() - 1
|
|
2006
2100
|
fcontentstart = fp.tell()
|
|
2007
|
-
fcontents =
|
|
2101
|
+
fcontents = MkTempFile()
|
|
2008
2102
|
if(fsize > 0 and not listonly):
|
|
2009
2103
|
if(fcompression == "none" or fcompression == "" or fcompression == "auto"):
|
|
2010
2104
|
fcontents.write(fp.read(fsize))
|
|
@@ -2031,7 +2125,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2031
2125
|
if(uncompress):
|
|
2032
2126
|
cfcontents = UncompressFileAlt(fcontents, formatspecs)
|
|
2033
2127
|
cfcontents.seek(0, 0)
|
|
2034
|
-
fcontents =
|
|
2128
|
+
fcontents = MkTempFile()
|
|
2035
2129
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2036
2130
|
cfcontents.close()
|
|
2037
2131
|
fcontents.seek(0, 0)
|
|
@@ -2145,7 +2239,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2145
2239
|
fjsoncontent = {}
|
|
2146
2240
|
elif(fjsontype=="list"):
|
|
2147
2241
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
2148
|
-
flisttmp =
|
|
2242
|
+
flisttmp = MkTempFile()
|
|
2149
2243
|
flisttmp.write(fprejsoncontent.encode())
|
|
2150
2244
|
flisttmp.seek(0)
|
|
2151
2245
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
@@ -2181,7 +2275,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2181
2275
|
return False
|
|
2182
2276
|
fhend = fp.tell() - 1
|
|
2183
2277
|
fcontentstart = fp.tell()
|
|
2184
|
-
fcontents =
|
|
2278
|
+
fcontents = MkTempFile()
|
|
2185
2279
|
pyhascontents = False
|
|
2186
2280
|
if(fsize > 0 and not listonly):
|
|
2187
2281
|
if(fcompression == "none" or fcompression == "" or fcompression == "auto"):
|
|
@@ -2212,7 +2306,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2212
2306
|
cfcontents = UncompressFileAlt(
|
|
2213
2307
|
fcontents, formatspecs)
|
|
2214
2308
|
cfcontents.seek(0, 0)
|
|
2215
|
-
fcontents =
|
|
2309
|
+
fcontents = MkTempFile()
|
|
2216
2310
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2217
2311
|
cfcontents.close()
|
|
2218
2312
|
fcontents.seek(0, 0)
|
|
@@ -2331,7 +2425,7 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2331
2425
|
fjsoncontent = {}
|
|
2332
2426
|
elif(fjsontype=="list"):
|
|
2333
2427
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
2334
|
-
flisttmp =
|
|
2428
|
+
flisttmp = MkTempFile()
|
|
2335
2429
|
flisttmp.write(fprejsoncontent.encode())
|
|
2336
2430
|
flisttmp.seek(0)
|
|
2337
2431
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
@@ -2366,7 +2460,7 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2366
2460
|
return False
|
|
2367
2461
|
fhend = fp.tell() - 1
|
|
2368
2462
|
fcontentstart = fp.tell()
|
|
2369
|
-
fcontents =
|
|
2463
|
+
fcontents = MkTempFile()
|
|
2370
2464
|
pyhascontents = False
|
|
2371
2465
|
if(fsize > 0 and not listonly):
|
|
2372
2466
|
if(fcompression == "none" or fcompression == "" or fcompression == "auto"):
|
|
@@ -2396,7 +2490,7 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2396
2490
|
cfcontents = UncompressFileAlt(
|
|
2397
2491
|
fcontents, formatspecs)
|
|
2398
2492
|
cfcontents.seek(0, 0)
|
|
2399
|
-
fcontents =
|
|
2493
|
+
fcontents = MkTempFile()
|
|
2400
2494
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2401
2495
|
cfcontents.close()
|
|
2402
2496
|
fcontents.seek(0, 0)
|
|
@@ -2596,7 +2690,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2596
2690
|
invalid_archive = True
|
|
2597
2691
|
prefhend = fp.tell() - 1
|
|
2598
2692
|
prefcontentstart = fp.tell()
|
|
2599
|
-
prefcontents =
|
|
2693
|
+
prefcontents = MkTempFile()
|
|
2600
2694
|
pyhascontents = False
|
|
2601
2695
|
if(prefsize > 0):
|
|
2602
2696
|
prefcontents.write(fp.read(prefsize))
|
|
@@ -2864,7 +2958,7 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2864
2958
|
return False
|
|
2865
2959
|
fp.seek(0, 0)
|
|
2866
2960
|
elif(infile == "-"):
|
|
2867
|
-
fp =
|
|
2961
|
+
fp = MkTempFile()
|
|
2868
2962
|
if(hasattr(sys.stdin, "buffer")):
|
|
2869
2963
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
2870
2964
|
else:
|
|
@@ -2885,7 +2979,7 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2885
2979
|
return False
|
|
2886
2980
|
fp.seek(0, 0)
|
|
2887
2981
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
2888
|
-
fp =
|
|
2982
|
+
fp = MkTempFile()
|
|
2889
2983
|
fp.write(infile)
|
|
2890
2984
|
fp.seek(0, 0)
|
|
2891
2985
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -3052,7 +3146,7 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3052
3146
|
return False
|
|
3053
3147
|
fp.seek(0, 0)
|
|
3054
3148
|
elif(infile == "-"):
|
|
3055
|
-
fp =
|
|
3149
|
+
fp = MkTempFile()
|
|
3056
3150
|
if(hasattr(sys.stdin, "buffer")):
|
|
3057
3151
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
3058
3152
|
else:
|
|
@@ -3073,7 +3167,7 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3073
3167
|
return False
|
|
3074
3168
|
fp.seek(0, 0)
|
|
3075
3169
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
3076
|
-
fp =
|
|
3170
|
+
fp = MkTempFile()
|
|
3077
3171
|
fp.write(infile)
|
|
3078
3172
|
fp.seek(0, 0)
|
|
3079
3173
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -3277,7 +3371,7 @@ def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc3
|
|
|
3277
3371
|
return fp
|
|
3278
3372
|
|
|
3279
3373
|
|
|
3280
|
-
def
|
|
3374
|
+
def MakeEmptyFoxFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc32", formatspecs=__file_format_multi_dict__):
|
|
3281
3375
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
3282
3376
|
|
|
3283
3377
|
|
|
@@ -3308,11 +3402,11 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3308
3402
|
pass
|
|
3309
3403
|
if(outfile == "-" or outfile is None):
|
|
3310
3404
|
verbose = False
|
|
3311
|
-
fp =
|
|
3405
|
+
fp = MkTempFile()
|
|
3312
3406
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3313
3407
|
fp = outfile
|
|
3314
3408
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3315
|
-
fp =
|
|
3409
|
+
fp = MkTempFile()
|
|
3316
3410
|
else:
|
|
3317
3411
|
fbasename = os.path.splitext(outfile)[0]
|
|
3318
3412
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -3360,7 +3454,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3360
3454
|
return True
|
|
3361
3455
|
|
|
3362
3456
|
|
|
3363
|
-
def
|
|
3457
|
+
def MakeEmptyFoxFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_dict__, returnfp=False):
|
|
3364
3458
|
return MakeEmptyFile(outfile, "auto", compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, formatspecs, returnfp)
|
|
3365
3459
|
|
|
3366
3460
|
|
|
@@ -3644,7 +3738,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3644
3738
|
fwinattributes = format(int(0), 'x').lower()
|
|
3645
3739
|
fcompression = ""
|
|
3646
3740
|
fcsize = format(int(0), 'x').lower()
|
|
3647
|
-
fcontents =
|
|
3741
|
+
fcontents = MkTempFile()
|
|
3648
3742
|
chunk_size = 1024
|
|
3649
3743
|
fcencoding = "UTF-8"
|
|
3650
3744
|
curcompression = "none"
|
|
@@ -3663,7 +3757,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3663
3757
|
ilmin = 0
|
|
3664
3758
|
ilcsize = []
|
|
3665
3759
|
while(ilmin < ilsize):
|
|
3666
|
-
cfcontents =
|
|
3760
|
+
cfcontents = MkTempFile()
|
|
3667
3761
|
fcontents.seek(0, 0)
|
|
3668
3762
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3669
3763
|
fcontents.seek(0, 0)
|
|
@@ -3680,7 +3774,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3680
3774
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3681
3775
|
curcompression = compressionuselist[ilcmin]
|
|
3682
3776
|
fcontents.seek(0, 0)
|
|
3683
|
-
cfcontents =
|
|
3777
|
+
cfcontents = MkTempFile()
|
|
3684
3778
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3685
3779
|
cfcontents.seek(0, 0)
|
|
3686
3780
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -3710,7 +3804,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3710
3804
|
ilmin = 0
|
|
3711
3805
|
ilcsize = []
|
|
3712
3806
|
while(ilmin < ilsize):
|
|
3713
|
-
cfcontents =
|
|
3807
|
+
cfcontents = MkTempFile()
|
|
3714
3808
|
fcontents.seek(0, 0)
|
|
3715
3809
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3716
3810
|
fcontents.seek(0, 0)
|
|
@@ -3727,7 +3821,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3727
3821
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3728
3822
|
curcompression = compressionuselist[ilcmin]
|
|
3729
3823
|
fcontents.seek(0, 0)
|
|
3730
|
-
cfcontents =
|
|
3824
|
+
cfcontents = MkTempFile()
|
|
3731
3825
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3732
3826
|
cfcontents.seek(0, 0)
|
|
3733
3827
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -3857,11 +3951,11 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3857
3951
|
pass
|
|
3858
3952
|
if(outfile == "-" or outfile is None):
|
|
3859
3953
|
verbose = False
|
|
3860
|
-
fp =
|
|
3954
|
+
fp = MkTempFile()
|
|
3861
3955
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3862
3956
|
fp = outfile
|
|
3863
3957
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3864
|
-
fp =
|
|
3958
|
+
fp = MkTempFile()
|
|
3865
3959
|
else:
|
|
3866
3960
|
fbasename = os.path.splitext(outfile)[0]
|
|
3867
3961
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -3937,11 +4031,11 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3937
4031
|
pass
|
|
3938
4032
|
if(outfile == "-" or outfile is None):
|
|
3939
4033
|
verbose = False
|
|
3940
|
-
fp =
|
|
4034
|
+
fp = MkTempFile()
|
|
3941
4035
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3942
4036
|
fp = outfile
|
|
3943
4037
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3944
|
-
fp =
|
|
4038
|
+
fp = MkTempFile()
|
|
3945
4039
|
else:
|
|
3946
4040
|
fbasename = os.path.splitext(outfile)[0]
|
|
3947
4041
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -4058,7 +4152,7 @@ def GzipCompressData(data, compresslevel=9):
|
|
|
4058
4152
|
compressed_data = gzip.compress(data, compresslevel=compresslevel)
|
|
4059
4153
|
except AttributeError:
|
|
4060
4154
|
# Fallback to older method for Python 2.x and older 3.x versions
|
|
4061
|
-
out =
|
|
4155
|
+
out = MkTempFile()
|
|
4062
4156
|
with gzip.GzipFile(fileobj=out, mode="wb", compresslevel=compresslevel) as f:
|
|
4063
4157
|
f.write(data)
|
|
4064
4158
|
compressed_data = out.getvalue()
|
|
@@ -4071,7 +4165,7 @@ def GzipDecompressData(compressed_data):
|
|
|
4071
4165
|
decompressed_data = gzip.decompress(compressed_data)
|
|
4072
4166
|
except AttributeError:
|
|
4073
4167
|
# Fallback to older method for Python 2.x and older 3.x versions
|
|
4074
|
-
inp =
|
|
4168
|
+
inp = MkTempFile(compressed_data)
|
|
4075
4169
|
with gzip.GzipFile(fileobj=inp, mode="rb") as f:
|
|
4076
4170
|
decompressed_data = f.read()
|
|
4077
4171
|
return decompressed_data
|
|
@@ -4204,9 +4298,9 @@ def GetFileEncoding(infile, closefp=True):
|
|
|
4204
4298
|
|
|
4205
4299
|
def GetFileEncodingFromString(instring, closefp=True):
|
|
4206
4300
|
try:
|
|
4207
|
-
instringsfile =
|
|
4301
|
+
instringsfile = MkTempFile(instring)
|
|
4208
4302
|
except TypeError:
|
|
4209
|
-
instringsfile =
|
|
4303
|
+
instringsfile = MkTempFile(instring.encode("UTF-8"))
|
|
4210
4304
|
return GetFileEncoding(instringsfile, closefp)
|
|
4211
4305
|
|
|
4212
4306
|
|
|
@@ -4469,17 +4563,17 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_multi_dict__, clos
|
|
|
4469
4563
|
|
|
4470
4564
|
def CheckCompressionTypeFromString(instring, formatspecs=__file_format_multi_dict__, closefp=True):
|
|
4471
4565
|
try:
|
|
4472
|
-
instringsfile =
|
|
4566
|
+
instringsfile = MkTempFile(instring)
|
|
4473
4567
|
except TypeError:
|
|
4474
|
-
instringsfile =
|
|
4568
|
+
instringsfile = MkTempFile(instring.encode("UTF-8"))
|
|
4475
4569
|
return CheckCompressionType(instringsfile, formatspecs, closefp)
|
|
4476
4570
|
|
|
4477
4571
|
|
|
4478
4572
|
def CheckCompressionTypeFromBytes(instring, formatspecs=__file_format_multi_dict__, closefp=True):
|
|
4479
4573
|
try:
|
|
4480
|
-
instringsfile =
|
|
4574
|
+
instringsfile = MkTempFile(instring)
|
|
4481
4575
|
except TypeError:
|
|
4482
|
-
instringsfile =
|
|
4576
|
+
instringsfile = MkTempFile(instring.decode("UTF-8"))
|
|
4483
4577
|
return CheckCompressionType(instringsfile, formatspecs, closefp)
|
|
4484
4578
|
|
|
4485
4579
|
|
|
@@ -4646,7 +4740,7 @@ def UncompressBytes(infile, formatspecs=__file_format_multi_dict__):
|
|
|
4646
4740
|
|
|
4647
4741
|
|
|
4648
4742
|
def UncompressBytesAlt(inbytes, formatspecs=__file_format_multi_dict__):
|
|
4649
|
-
filefp =
|
|
4743
|
+
filefp = MkTempFile()
|
|
4650
4744
|
outstring = UncompressBytes(inbytes, formatspecs)
|
|
4651
4745
|
filefp.write(outstring)
|
|
4652
4746
|
filefp.seek(0, 0)
|
|
@@ -4662,7 +4756,7 @@ def UncompressBytesAltFP(fp, formatspecs=__file_format_multi_dict__):
|
|
|
4662
4756
|
fp.seek(0, 0)
|
|
4663
4757
|
if(prechck!="zstd"):
|
|
4664
4758
|
return UncompressFileAlt(fp, formatspecs)
|
|
4665
|
-
filefp =
|
|
4759
|
+
filefp = MkTempFile()
|
|
4666
4760
|
fp.seek(0, 0)
|
|
4667
4761
|
outstring = UncompressBytes(fp.read(), formatspecs)
|
|
4668
4762
|
filefp.write(outstring)
|
|
@@ -4679,7 +4773,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4679
4773
|
if(compression not in compressionuselist and compression is None):
|
|
4680
4774
|
compression = "auto"
|
|
4681
4775
|
if(compression == "gzip" and compression in compressionsupport):
|
|
4682
|
-
bytesfp =
|
|
4776
|
+
bytesfp = MkTempFile()
|
|
4683
4777
|
if(compressionlevel is None):
|
|
4684
4778
|
compressionlevel = 9
|
|
4685
4779
|
else:
|
|
@@ -4687,7 +4781,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4687
4781
|
bytesfp.write(GzipCompressData(
|
|
4688
4782
|
fp.read(), compresslevel=compressionlevel))
|
|
4689
4783
|
elif(compression == "bzip2" and compression in compressionsupport):
|
|
4690
|
-
bytesfp =
|
|
4784
|
+
bytesfp = MkTempFile()
|
|
4691
4785
|
if(compressionlevel is None):
|
|
4692
4786
|
compressionlevel = 9
|
|
4693
4787
|
else:
|
|
@@ -4695,7 +4789,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4695
4789
|
bytesfp.write(BzipCompressData(
|
|
4696
4790
|
fp.read(), compresslevel=compressionlevel))
|
|
4697
4791
|
elif(compression == "lz4" and compression in compressionsupport):
|
|
4698
|
-
bytesfp =
|
|
4792
|
+
bytesfp = MkTempFile()
|
|
4699
4793
|
if(compressionlevel is None):
|
|
4700
4794
|
compressionlevel = 9
|
|
4701
4795
|
else:
|
|
@@ -4703,14 +4797,14 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4703
4797
|
bytesfp.write(lz4.frame.compress(
|
|
4704
4798
|
fp.read(), compression_level=compressionlevel))
|
|
4705
4799
|
elif((compression == "lzo" or compression == "lzop") and compression in compressionsupport):
|
|
4706
|
-
bytesfp =
|
|
4800
|
+
bytesfp = MkTempFile()
|
|
4707
4801
|
if(compressionlevel is None):
|
|
4708
4802
|
compressionlevel = 9
|
|
4709
4803
|
else:
|
|
4710
4804
|
compressionlevel = int(compressionlevel)
|
|
4711
4805
|
bytesfp.write(lzo.compress(fp.read(), compressionlevel))
|
|
4712
4806
|
elif(compression == "zstd" and compression in compressionsupport):
|
|
4713
|
-
bytesfp =
|
|
4807
|
+
bytesfp = MkTempFile()
|
|
4714
4808
|
if(compressionlevel is None):
|
|
4715
4809
|
compressionlevel = 9
|
|
4716
4810
|
else:
|
|
@@ -4718,7 +4812,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4718
4812
|
compressor = zstandard.ZstdCompressor(compressionlevel, threads=get_default_threads())
|
|
4719
4813
|
bytesfp.write(compressor.compress(fp.read()))
|
|
4720
4814
|
elif(compression == "lzma" and compression in compressionsupport):
|
|
4721
|
-
bytesfp =
|
|
4815
|
+
bytesfp = MkTempFile()
|
|
4722
4816
|
if(compressionlevel is None):
|
|
4723
4817
|
compressionlevel = 9
|
|
4724
4818
|
else:
|
|
@@ -4728,7 +4822,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4728
4822
|
except (NotImplementedError, lzma.LZMAError):
|
|
4729
4823
|
bytesfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_ALONE))
|
|
4730
4824
|
elif(compression == "xz" and compression in compressionsupport):
|
|
4731
|
-
bytesfp =
|
|
4825
|
+
bytesfp = MkTempFile()
|
|
4732
4826
|
if(compressionlevel is None):
|
|
4733
4827
|
compressionlevel = 9
|
|
4734
4828
|
else:
|
|
@@ -4738,7 +4832,7 @@ def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressi
|
|
|
4738
4832
|
except (NotImplementedError, lzma.LZMAError):
|
|
4739
4833
|
bytesfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_XZ))
|
|
4740
4834
|
elif(compression == "zlib" and compression in compressionsupport):
|
|
4741
|
-
bytesfp =
|
|
4835
|
+
bytesfp = MkTempFile()
|
|
4742
4836
|
if(compressionlevel is None):
|
|
4743
4837
|
compressionlevel = 9
|
|
4744
4838
|
else:
|
|
@@ -4908,11 +5002,11 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
4908
5002
|
pass
|
|
4909
5003
|
if(outfile == "-" or outfile is None):
|
|
4910
5004
|
verbose = False
|
|
4911
|
-
fp =
|
|
5005
|
+
fp = MkTempFile()
|
|
4912
5006
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
4913
5007
|
fp = outfile
|
|
4914
5008
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
4915
|
-
fp =
|
|
5009
|
+
fp = MkTempFile()
|
|
4916
5010
|
else:
|
|
4917
5011
|
fbasename = os.path.splitext(outfile)[0]
|
|
4918
5012
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -5107,7 +5201,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5107
5201
|
fwinattributes = format(int(0), 'x').lower()
|
|
5108
5202
|
fcompression = ""
|
|
5109
5203
|
fcsize = format(int(0), 'x').lower()
|
|
5110
|
-
fcontents =
|
|
5204
|
+
fcontents = MkTempFile()
|
|
5111
5205
|
fcencoding = "UTF-8"
|
|
5112
5206
|
curcompression = "none"
|
|
5113
5207
|
if not followlink and ftype in data_types:
|
|
@@ -5125,7 +5219,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5125
5219
|
ilmin = 0
|
|
5126
5220
|
ilcsize = []
|
|
5127
5221
|
while(ilmin < ilsize):
|
|
5128
|
-
cfcontents =
|
|
5222
|
+
cfcontents = MkTempFile()
|
|
5129
5223
|
fcontents.seek(0, 0)
|
|
5130
5224
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5131
5225
|
fcontents.seek(0, 0)
|
|
@@ -5142,7 +5236,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5142
5236
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5143
5237
|
curcompression = compressionuselist[ilcmin]
|
|
5144
5238
|
fcontents.seek(0, 0)
|
|
5145
|
-
cfcontents =
|
|
5239
|
+
cfcontents = MkTempFile()
|
|
5146
5240
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5147
5241
|
cfcontents.seek(0, 0)
|
|
5148
5242
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -5172,7 +5266,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5172
5266
|
ilmin = 0
|
|
5173
5267
|
ilcsize = []
|
|
5174
5268
|
while(ilmin < ilsize):
|
|
5175
|
-
cfcontents =
|
|
5269
|
+
cfcontents = MkTempFile()
|
|
5176
5270
|
fcontents.seek(0, 0)
|
|
5177
5271
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5178
5272
|
fcontents.seek(0, 0)
|
|
@@ -5189,7 +5283,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5189
5283
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5190
5284
|
curcompression = compressionuselist[ilcmin]
|
|
5191
5285
|
fcontents.seek(0, 0)
|
|
5192
|
-
cfcontents =
|
|
5286
|
+
cfcontents = MkTempFile()
|
|
5193
5287
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5194
5288
|
cfcontents.seek(0, 0)
|
|
5195
5289
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -5292,11 +5386,11 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5292
5386
|
pass
|
|
5293
5387
|
if(outfile == "-" or outfile is None):
|
|
5294
5388
|
verbose = False
|
|
5295
|
-
fp =
|
|
5389
|
+
fp = MkTempFile()
|
|
5296
5390
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5297
5391
|
fp = outfile
|
|
5298
5392
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5299
|
-
fp =
|
|
5393
|
+
fp = MkTempFile()
|
|
5300
5394
|
else:
|
|
5301
5395
|
fbasename = os.path.splitext(outfile)[0]
|
|
5302
5396
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -5315,7 +5409,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5315
5409
|
filetoinode = {}
|
|
5316
5410
|
inodetoforminode = {}
|
|
5317
5411
|
if(infile == "-"):
|
|
5318
|
-
infile =
|
|
5412
|
+
infile = MkTempFile()
|
|
5319
5413
|
if(hasattr(sys.stdin, "buffer")):
|
|
5320
5414
|
shutil.copyfileobj(sys.stdin.buffer, infile)
|
|
5321
5415
|
else:
|
|
@@ -5454,13 +5548,13 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5454
5548
|
fwinattributes = format(int(0), 'x').lower()
|
|
5455
5549
|
fcompression = ""
|
|
5456
5550
|
fcsize = format(int(0), 'x').lower()
|
|
5457
|
-
fcontents =
|
|
5551
|
+
fcontents = MkTempFile()
|
|
5458
5552
|
fcencoding = "UTF-8"
|
|
5459
5553
|
curcompression = "none"
|
|
5460
5554
|
if ftype in data_types:
|
|
5461
5555
|
fpc = tarfp.extractfile(member)
|
|
5462
|
-
fpc.close()
|
|
5463
5556
|
shutil.copyfileobj(fpc, fcontents)
|
|
5557
|
+
fpc.close()
|
|
5464
5558
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5465
5559
|
fcontents.seek(0, 0)
|
|
5466
5560
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
@@ -5473,7 +5567,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5473
5567
|
ilmin = 0
|
|
5474
5568
|
ilcsize = []
|
|
5475
5569
|
while(ilmin < ilsize):
|
|
5476
|
-
cfcontents =
|
|
5570
|
+
cfcontents = MkTempFile()
|
|
5477
5571
|
fcontents.seek(0, 0)
|
|
5478
5572
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5479
5573
|
fcontents.seek(0, 0)
|
|
@@ -5490,7 +5584,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5490
5584
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5491
5585
|
curcompression = compressionuselist[ilcmin]
|
|
5492
5586
|
fcontents.seek(0, 0)
|
|
5493
|
-
cfcontents =
|
|
5587
|
+
cfcontents = MkTempFile()
|
|
5494
5588
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5495
5589
|
cfcontents.seek(0, 0)
|
|
5496
5590
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -5589,11 +5683,11 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5589
5683
|
pass
|
|
5590
5684
|
if(outfile == "-" or outfile is None):
|
|
5591
5685
|
verbose = False
|
|
5592
|
-
fp =
|
|
5686
|
+
fp = MkTempFile()
|
|
5593
5687
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5594
5688
|
fp = outfile
|
|
5595
5689
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5596
|
-
fp =
|
|
5690
|
+
fp = MkTempFile()
|
|
5597
5691
|
else:
|
|
5598
5692
|
fbasename = os.path.splitext(outfile)[0]
|
|
5599
5693
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -5612,7 +5706,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5612
5706
|
filetoinode = {}
|
|
5613
5707
|
inodetoforminode = {}
|
|
5614
5708
|
if(infile == "-"):
|
|
5615
|
-
infile =
|
|
5709
|
+
infile = MkTempFile()
|
|
5616
5710
|
if(hasattr(sys.stdin, "buffer")):
|
|
5617
5711
|
shutil.copyfileobj(sys.stdin.buffer, infile)
|
|
5618
5712
|
else:
|
|
@@ -5753,7 +5847,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5753
5847
|
fgname = ""
|
|
5754
5848
|
except ImportError:
|
|
5755
5849
|
fgname = ""
|
|
5756
|
-
fcontents =
|
|
5850
|
+
fcontents = MkTempFile()
|
|
5757
5851
|
fcencoding = "UTF-8"
|
|
5758
5852
|
curcompression = "none"
|
|
5759
5853
|
if ftype == 0:
|
|
@@ -5770,7 +5864,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5770
5864
|
ilmin = 0
|
|
5771
5865
|
ilcsize = []
|
|
5772
5866
|
while(ilmin < ilsize):
|
|
5773
|
-
cfcontents =
|
|
5867
|
+
cfcontents = MkTempFile()
|
|
5774
5868
|
fcontents.seek(0, 0)
|
|
5775
5869
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5776
5870
|
fcontents.seek(0, 0)
|
|
@@ -5784,7 +5878,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5784
5878
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5785
5879
|
curcompression = compressionuselist[ilcmin]
|
|
5786
5880
|
fcontents.seek(0, 0)
|
|
5787
|
-
cfcontents =
|
|
5881
|
+
cfcontents = MkTempFile()
|
|
5788
5882
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5789
5883
|
cfcontents.seek(0, 0)
|
|
5790
5884
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -5888,11 +5982,11 @@ if(rarfile_support):
|
|
|
5888
5982
|
pass
|
|
5889
5983
|
if(outfile == "-" or outfile is None):
|
|
5890
5984
|
verbose = False
|
|
5891
|
-
fp =
|
|
5985
|
+
fp = MkTempFile()
|
|
5892
5986
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5893
5987
|
fp = outfile
|
|
5894
5988
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5895
|
-
fp =
|
|
5989
|
+
fp = MkTempFile()
|
|
5896
5990
|
else:
|
|
5897
5991
|
fbasename = os.path.splitext(outfile)[0]
|
|
5898
5992
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -6070,7 +6164,7 @@ if(rarfile_support):
|
|
|
6070
6164
|
fgname = ""
|
|
6071
6165
|
except ImportError:
|
|
6072
6166
|
fgname = ""
|
|
6073
|
-
fcontents =
|
|
6167
|
+
fcontents = MkTempFile()
|
|
6074
6168
|
fcencoding = "UTF-8"
|
|
6075
6169
|
curcompression = "none"
|
|
6076
6170
|
if ftype == 0:
|
|
@@ -6087,7 +6181,7 @@ if(rarfile_support):
|
|
|
6087
6181
|
ilmin = 0
|
|
6088
6182
|
ilcsize = []
|
|
6089
6183
|
while(ilmin < ilsize):
|
|
6090
|
-
cfcontents =
|
|
6184
|
+
cfcontents = MkTempFile()
|
|
6091
6185
|
fcontents.seek(0, 0)
|
|
6092
6186
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6093
6187
|
fcontents.seek(0, 0)
|
|
@@ -6104,7 +6198,7 @@ if(rarfile_support):
|
|
|
6104
6198
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6105
6199
|
curcompression = compressionuselist[ilcmin]
|
|
6106
6200
|
fcontents.seek(0, 0)
|
|
6107
|
-
cfcontents =
|
|
6201
|
+
cfcontents = MkTempFile()
|
|
6108
6202
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6109
6203
|
cfcontents.seek(0, 0)
|
|
6110
6204
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -6208,11 +6302,11 @@ if(py7zr_support):
|
|
|
6208
6302
|
pass
|
|
6209
6303
|
if(outfile == "-" or outfile is None):
|
|
6210
6304
|
verbose = False
|
|
6211
|
-
fp =
|
|
6305
|
+
fp = MkTempFile()
|
|
6212
6306
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6213
6307
|
fp = outfile
|
|
6214
6308
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6215
|
-
fp =
|
|
6309
|
+
fp = MkTempFile()
|
|
6216
6310
|
else:
|
|
6217
6311
|
fbasename = os.path.splitext(outfile)[0]
|
|
6218
6312
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -6321,7 +6415,7 @@ if(py7zr_support):
|
|
|
6321
6415
|
fgname = ""
|
|
6322
6416
|
except ImportError:
|
|
6323
6417
|
fgname = ""
|
|
6324
|
-
fcontents =
|
|
6418
|
+
fcontents = MkTempFile()
|
|
6325
6419
|
fcencoding = "UTF-8"
|
|
6326
6420
|
curcompression = "none"
|
|
6327
6421
|
if ftype == 0:
|
|
@@ -6341,7 +6435,7 @@ if(py7zr_support):
|
|
|
6341
6435
|
ilmin = 0
|
|
6342
6436
|
ilcsize = []
|
|
6343
6437
|
while(ilmin < ilsize):
|
|
6344
|
-
cfcontents =
|
|
6438
|
+
cfcontents = MkTempFile()
|
|
6345
6439
|
fcontents.seek(0, 0)
|
|
6346
6440
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6347
6441
|
fcontents.seek(0, 0)
|
|
@@ -6358,7 +6452,7 @@ if(py7zr_support):
|
|
|
6358
6452
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6359
6453
|
curcompression = compressionuselist[ilcmin]
|
|
6360
6454
|
fcontents.seek(0, 0)
|
|
6361
|
-
cfcontents =
|
|
6455
|
+
cfcontents = MkTempFile()
|
|
6362
6456
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6363
6457
|
cfcontents.seek(0, 0)
|
|
6364
6458
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -6473,7 +6567,7 @@ def FoxFileSeekToFileNum(infile, fmttype="auto", seekto=0, listonly=False, conte
|
|
|
6473
6567
|
return False
|
|
6474
6568
|
fp.seek(0, 0)
|
|
6475
6569
|
elif(infile == "-"):
|
|
6476
|
-
fp =
|
|
6570
|
+
fp = MkTempFile()
|
|
6477
6571
|
if(hasattr(sys.stdin, "buffer")):
|
|
6478
6572
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
6479
6573
|
else:
|
|
@@ -6487,7 +6581,7 @@ def FoxFileSeekToFileNum(infile, fmttype="auto", seekto=0, listonly=False, conte
|
|
|
6487
6581
|
return False
|
|
6488
6582
|
fp.seek(0, 0)
|
|
6489
6583
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
6490
|
-
fp =
|
|
6584
|
+
fp = MkTempFile()
|
|
6491
6585
|
fp.write(infile)
|
|
6492
6586
|
fp.seek(0, 0)
|
|
6493
6587
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -6788,7 +6882,7 @@ def FoxFileSeekToFileName(infile, fmttype="auto", seekfile=None, listonly=False,
|
|
|
6788
6882
|
return False
|
|
6789
6883
|
fp.seek(0, 0)
|
|
6790
6884
|
elif(infile == "-"):
|
|
6791
|
-
fp =
|
|
6885
|
+
fp = MkTempFile()
|
|
6792
6886
|
if(hasattr(sys.stdin, "buffer")):
|
|
6793
6887
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
6794
6888
|
else:
|
|
@@ -6802,7 +6896,7 @@ def FoxFileSeekToFileName(infile, fmttype="auto", seekfile=None, listonly=False,
|
|
|
6802
6896
|
return False
|
|
6803
6897
|
fp.seek(0, 0)
|
|
6804
6898
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
6805
|
-
fp =
|
|
6899
|
+
fp = MkTempFile()
|
|
6806
6900
|
fp.write(infile)
|
|
6807
6901
|
fp.seek(0, 0)
|
|
6808
6902
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -7109,7 +7203,7 @@ def FoxFileValidate(infile, fmttype="auto", formatspecs=__file_format_multi_dict
|
|
|
7109
7203
|
return False
|
|
7110
7204
|
fp.seek(0, 0)
|
|
7111
7205
|
elif(infile == "-"):
|
|
7112
|
-
fp =
|
|
7206
|
+
fp = MkTempFile()
|
|
7113
7207
|
if(hasattr(sys.stdin, "buffer")):
|
|
7114
7208
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
7115
7209
|
else:
|
|
@@ -7123,7 +7217,7 @@ def FoxFileValidate(infile, fmttype="auto", formatspecs=__file_format_multi_dict
|
|
|
7123
7217
|
return False
|
|
7124
7218
|
fp.seek(0, 0)
|
|
7125
7219
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
7126
|
-
fp =
|
|
7220
|
+
fp = MkTempFile()
|
|
7127
7221
|
fp.write(infile)
|
|
7128
7222
|
fp.seek(0, 0)
|
|
7129
7223
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -7461,7 +7555,7 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7461
7555
|
return False
|
|
7462
7556
|
fp.seek(0, 0)
|
|
7463
7557
|
elif(infile == "-"):
|
|
7464
|
-
fp =
|
|
7558
|
+
fp = MkTempFile()
|
|
7465
7559
|
if(hasattr(sys.stdin, "buffer")):
|
|
7466
7560
|
shutil.copyfileobj(sys.stdin.buffer, fp)
|
|
7467
7561
|
else:
|
|
@@ -7475,7 +7569,7 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7475
7569
|
return False
|
|
7476
7570
|
fp.seek(0, 0)
|
|
7477
7571
|
elif(isinstance(infile, bytes) and sys.version_info[0] >= 3):
|
|
7478
|
-
fp =
|
|
7572
|
+
fp = MkTempFile()
|
|
7479
7573
|
fp.write(infile)
|
|
7480
7574
|
fp.seek(0, 0)
|
|
7481
7575
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
@@ -7775,7 +7869,7 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7775
7869
|
outfjsoncontent = {}
|
|
7776
7870
|
elif(outfjsontype=="list"):
|
|
7777
7871
|
outfprejsoncontent = fp.read(outfjsonsize).decode("UTF-8")
|
|
7778
|
-
flisttmp =
|
|
7872
|
+
flisttmp = MkTempFile()
|
|
7779
7873
|
flisttmp.write(outfprejsoncontent.encode())
|
|
7780
7874
|
flisttmp.seek(0)
|
|
7781
7875
|
outfjsoncontent = ReadFileHeaderData(flisttmp, outfjsonlen, formatspecs['format_delimiter'])
|
|
@@ -7828,7 +7922,7 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7828
7922
|
VerbosePrintOut("'" + outfjsonchecksum + "' != " + "'" + injsonfcs + "'")
|
|
7829
7923
|
return False
|
|
7830
7924
|
outfcontentstart = fp.tell()
|
|
7831
|
-
outfcontents =
|
|
7925
|
+
outfcontents = MkTempFile()
|
|
7832
7926
|
pyhascontents = False
|
|
7833
7927
|
if(outfsize > 0 and not listonly):
|
|
7834
7928
|
if(outfcompression == "none" or outfcompression == "" or outfcompression == "auto"):
|
|
@@ -7853,7 +7947,7 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7853
7947
|
cfcontents = UncompressFileAlt(
|
|
7854
7948
|
outfcontents, formatspecs)
|
|
7855
7949
|
cfcontents.seek(0, 0)
|
|
7856
|
-
outfcontents =
|
|
7950
|
+
outfcontents = MkTempFile()
|
|
7857
7951
|
shutil.copyfileobj(cfcontents, outfcontents)
|
|
7858
7952
|
cfcontents.close()
|
|
7859
7953
|
outfcontents.seek(0, 0)
|
|
@@ -7903,7 +7997,7 @@ def MultipleFoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listo
|
|
|
7903
7997
|
infile = [infile]
|
|
7904
7998
|
outretval = {}
|
|
7905
7999
|
for curfname in infile:
|
|
7906
|
-
curretfile[curfname] =
|
|
8000
|
+
curretfile[curfname] = FoxFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7907
8001
|
return outretval
|
|
7908
8002
|
|
|
7909
8003
|
def MultipleFoxFilesToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, returnfp=False):
|
|
@@ -7914,7 +8008,7 @@ def FoxFileStringToArray(instr, seekstart=0, seekend=0, listonly=False, contenta
|
|
|
7914
8008
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True)
|
|
7915
8009
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
7916
8010
|
formatspecs = formatspecs[checkcompressfile]
|
|
7917
|
-
fp =
|
|
8011
|
+
fp = MkTempFile(instr)
|
|
7918
8012
|
listfoxfiles = FoxFileToArray(fp, "auto", seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7919
8013
|
return listfoxfiles
|
|
7920
8014
|
|
|
@@ -7923,7 +8017,7 @@ def TarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile
|
|
|
7923
8017
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True)
|
|
7924
8018
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
7925
8019
|
formatspecs = formatspecs[checkcompressfile]
|
|
7926
|
-
fp =
|
|
8020
|
+
fp = MkTempFile()
|
|
7927
8021
|
fp = PackFoxFileFromTarFile(
|
|
7928
8022
|
infile, fp, "auto", True, None, compressionlistalt, "crc32", [], formatspecs, False, True)
|
|
7929
8023
|
listfoxfiles = FoxFileToArray(fp, "auto", seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
@@ -7934,7 +8028,7 @@ def ZipFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile
|
|
|
7934
8028
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True)
|
|
7935
8029
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
7936
8030
|
formatspecs = formatspecs[checkcompressfile]
|
|
7937
|
-
fp =
|
|
8031
|
+
fp = MkTempFile()
|
|
7938
8032
|
fp = PackFoxFileFromZipFile(
|
|
7939
8033
|
infile, fp, "auto", True, None, compressionlistalt, "crc32", [], formatspecs, False, True)
|
|
7940
8034
|
listfoxfiles = FoxFileToArray(fp, "auto", seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
@@ -7950,7 +8044,7 @@ if(rarfile_support):
|
|
|
7950
8044
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True)
|
|
7951
8045
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
7952
8046
|
formatspecs = formatspecs[checkcompressfile]
|
|
7953
|
-
fp =
|
|
8047
|
+
fp = MkTempFile()
|
|
7954
8048
|
fp = PackFoxFileFromRarFile(
|
|
7955
8049
|
infile, fp, "auto", True, None, compressionlistalt, "crc32", [], formatspecs, False, True)
|
|
7956
8050
|
listfoxfiles = FoxFileToArray(fp, "auto", seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
@@ -7965,7 +8059,7 @@ if(py7zr_support):
|
|
|
7965
8059
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True)
|
|
7966
8060
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
7967
8061
|
formatspecs = formatspecs[checkcompressfile]
|
|
7968
|
-
fp =
|
|
8062
|
+
fp = MkTempFile()
|
|
7969
8063
|
fp = PackFoxFileFromSevenZipFile(
|
|
7970
8064
|
infile, fp, "auto", True, None, compressionlistalt, "crc32", [], formatspecs, False, True)
|
|
7971
8065
|
listfoxfiles = FoxFileToArray(fp, "auto", seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
@@ -7992,7 +8086,7 @@ def InFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=
|
|
|
7992
8086
|
|
|
7993
8087
|
|
|
7994
8088
|
def ListDirToArray(infiles, dirlistfromtxt=False, fmttype=__file_format_default__, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, seekstart=0, seekend=0, listonly=False, skipchecksum=False, checksumtype=["crc32", "crc32", "crc32"], extradata=[], formatspecs=__file_format_dict__, verbose=False, seektoend=False, returnfp=False):
|
|
7995
|
-
outarray =
|
|
8089
|
+
outarray = MkTempFile()
|
|
7996
8090
|
packform = PackFoxFile(infiles, outarray, dirlistfromtxt, fmttype, compression, compresswholefile,
|
|
7997
8091
|
compressionlevel, followlink, checksumtype, extradata, formatspecs, verbose, True)
|
|
7998
8092
|
listfoxfiles = FoxFileToArray(outarray, "auto", seekstart, seekend, listonly, True, skipchecksum, formatspecs, seektoend, returnfp)
|
|
@@ -8101,11 +8195,11 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8101
8195
|
return False
|
|
8102
8196
|
if(outfile == "-" or outfile is None):
|
|
8103
8197
|
verbose = False
|
|
8104
|
-
fp =
|
|
8198
|
+
fp = MkTempFile()
|
|
8105
8199
|
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8106
8200
|
fp = outfile
|
|
8107
8201
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8108
|
-
fp =
|
|
8202
|
+
fp = MkTempFile()
|
|
8109
8203
|
else:
|
|
8110
8204
|
fbasename = os.path.splitext(outfile)[0]
|
|
8111
8205
|
fextname = os.path.splitext(outfile)[1]
|
|
@@ -8193,7 +8287,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8193
8287
|
jsondata = listfoxfiles['ffilelist'][reallcfi]['fjsondata']
|
|
8194
8288
|
fcontents = listfoxfiles['ffilelist'][reallcfi]['fcontents']
|
|
8195
8289
|
if(not listfoxfiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8196
|
-
fcontents =
|
|
8290
|
+
fcontents = MkTempFile(fcontents)
|
|
8197
8291
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8198
8292
|
fcontents.seek(0, 0)
|
|
8199
8293
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
@@ -8209,7 +8303,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8209
8303
|
ilmin = 0
|
|
8210
8304
|
ilcsize = []
|
|
8211
8305
|
while(ilmin < ilsize):
|
|
8212
|
-
cfcontents =
|
|
8306
|
+
cfcontents = MkTempFile()
|
|
8213
8307
|
fcontents.seek(0, 0)
|
|
8214
8308
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8215
8309
|
fcontents.seek(0, 0)
|
|
@@ -8226,7 +8320,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8226
8320
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8227
8321
|
curcompression = compressionuselist[ilcmin]
|
|
8228
8322
|
fcontents.seek(0, 0)
|
|
8229
|
-
cfcontents =
|
|
8323
|
+
cfcontents = MkTempFile()
|
|
8230
8324
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8231
8325
|
cfcontents.seek(0, 0)
|
|
8232
8326
|
cfcontents = CompressOpenFileAlt(
|
|
@@ -8239,10 +8333,10 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8239
8333
|
fcontents.close()
|
|
8240
8334
|
fcontents = cfcontents
|
|
8241
8335
|
if followlink:
|
|
8242
|
-
if(
|
|
8243
|
-
getflinkpath =
|
|
8244
|
-
flinkid =
|
|
8245
|
-
flinkinfo =
|
|
8336
|
+
if(listfoxfiles['ffilelist'][reallcfi]['ftype'] == 1 or listfoxfiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8337
|
+
getflinkpath = listfoxfiles['ffilelist'][reallcfi]['flinkname']
|
|
8338
|
+
flinkid = prelistfoxfiles['filetoid'][getflinkpath]
|
|
8339
|
+
flinkinfo = listfoxfiles['ffilelist'][flinkid]
|
|
8246
8340
|
fheadersize = format(
|
|
8247
8341
|
int(flinkinfo['fheadersize']), 'x').lower()
|
|
8248
8342
|
fsize = format(int(flinkinfo['fsize']), 'x').lower()
|
|
@@ -8275,11 +8369,11 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8275
8369
|
extradata = flinkinfo['fjsondata']
|
|
8276
8370
|
fcontents = flinkinfo['fcontents']
|
|
8277
8371
|
if(not flinkinfo['fcontentasfile']):
|
|
8278
|
-
fcontents =
|
|
8372
|
+
fcontents = MkTempFile(fcontents)
|
|
8279
8373
|
ftypehex = format(flinkinfo['ftype'], 'x').lower()
|
|
8280
8374
|
else:
|
|
8281
8375
|
ftypehex = format(
|
|
8282
|
-
|
|
8376
|
+
listfoxfiles['ffilelist'][reallcfi]['ftype'], 'x').lower()
|
|
8283
8377
|
fcurfid = format(curfid, 'x').lower()
|
|
8284
8378
|
if(not followlink and finode != 0):
|
|
8285
8379
|
if(listfoxfiles['ffilelist'][reallcfi]['ftype'] != 1):
|
|
@@ -8346,14 +8440,14 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8346
8440
|
|
|
8347
8441
|
|
|
8348
8442
|
def RePackFoxFileFromString(instr, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["crc32", "crc32", "crc32"], skipchecksum=False, extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
8349
|
-
fp =
|
|
8443
|
+
fp = MkTempFile(instr)
|
|
8350
8444
|
listfoxfiles = RePackFoxFile(fp, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist,
|
|
8351
8445
|
checksumtype, skipchecksum, extradata, formatspecs, verbose, returnfp)
|
|
8352
8446
|
return listfoxfiles
|
|
8353
8447
|
|
|
8354
8448
|
|
|
8355
8449
|
def PackFoxFileFromListDir(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, skipchecksum=False, checksumtype=["crc32", "crc32", "crc32"], extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
8356
|
-
outarray =
|
|
8450
|
+
outarray = MkTempFile()
|
|
8357
8451
|
packform = PackFoxFile(infiles, outarray, dirlistfromtxt, fmttype, compression, compresswholefile,
|
|
8358
8452
|
compressionlevel, compressionuselist, followlink, checksumtype, extradata, formatspecs, verbose, True)
|
|
8359
8453
|
listfoxfiles = RePackFoxFile(outarray, outfile, fmttype, compression, compresswholefile,
|
|
@@ -8411,7 +8505,7 @@ def UnPackFoxFile(infile, outdir=None, followlink=False, seekstart=0, seekend=0,
|
|
|
8411
8505
|
if(listfoxfiles['ffilelist'][lcfi]['ftype'] == 0 or listfoxfiles['ffilelist'][lcfi]['ftype'] == 7):
|
|
8412
8506
|
with open(PrependPath(outdir, listfoxfiles['ffilelist'][lcfi]['fname']), "wb") as fpc:
|
|
8413
8507
|
if(not listfoxfiles['ffilelist'][lcfi]['fcontentasfile']):
|
|
8414
|
-
listfoxfiles['ffilelist'][lcfi]['fcontents'] =
|
|
8508
|
+
listfoxfiles['ffilelist'][lcfi]['fcontents'] = MkTempFile(
|
|
8415
8509
|
listfoxfiles['ffilelist'][lcfi]['fcontents'])
|
|
8416
8510
|
listfoxfiles['ffilelist'][lcfi]['fcontents'].seek(0, 0)
|
|
8417
8511
|
shutil.copyfileobj(
|
|
@@ -8463,7 +8557,7 @@ def UnPackFoxFile(infile, outdir=None, followlink=False, seekstart=0, seekend=0,
|
|
|
8463
8557
|
if(flinkinfo['ftype'] == 0 or flinkinfo['ftype'] == 7):
|
|
8464
8558
|
with open(PrependPath(outdir, listfoxfiles['ffilelist'][lcfi]['fname']), "wb") as fpc:
|
|
8465
8559
|
if(not flinkinfo['fcontentasfile']):
|
|
8466
|
-
flinkinfo['fcontents'] =
|
|
8560
|
+
flinkinfo['fcontents'] = MkTempFile(
|
|
8467
8561
|
flinkinfo['fcontents'])
|
|
8468
8562
|
flinkinfo['fcontents'].seek(0, 0)
|
|
8469
8563
|
shutil.copyfileobj(flinkinfo['fcontents'], fpc)
|
|
@@ -8542,7 +8636,7 @@ def UnPackFoxFile(infile, outdir=None, followlink=False, seekstart=0, seekend=0,
|
|
|
8542
8636
|
if(flinkinfo['ftype'] == 0 or flinkinfo['ftype'] == 7):
|
|
8543
8637
|
with open(PrependPath(outdir, listfoxfiles['ffilelist'][lcfi]['fname']), "wb") as fpc:
|
|
8544
8638
|
if(not flinkinfo['fcontentasfile']):
|
|
8545
|
-
flinkinfo['fcontents'] =
|
|
8639
|
+
flinkinfo['fcontents'] = MkTempFile(
|
|
8546
8640
|
flinkinfo['fcontents'])
|
|
8547
8641
|
flinkinfo['fcontents'].seek(0, 0)
|
|
8548
8642
|
shutil.copyfileobj(flinkinfo['fcontents'], fpc)
|
|
@@ -8620,7 +8714,7 @@ def UnPackFoxFile(infile, outdir=None, followlink=False, seekstart=0, seekend=0,
|
|
|
8620
8714
|
|
|
8621
8715
|
|
|
8622
8716
|
def UnPackFoxFileString(instr, outdir=None, followlink=False, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, verbose=False, returnfp=False):
|
|
8623
|
-
fp =
|
|
8717
|
+
fp = MkTempFile(instr)
|
|
8624
8718
|
listfoxfiles = UnPackFoxFile(fp, outdir, followlink, seekstart, seekend, skipchecksum, formatspecs, seektoend, verbose, returnfp)
|
|
8625
8719
|
return listfoxfiles
|
|
8626
8720
|
|
|
@@ -8643,57 +8737,57 @@ def FoxFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8643
8737
|
if(verbose):
|
|
8644
8738
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
8645
8739
|
if(isinstance(infile, dict)):
|
|
8646
|
-
|
|
8740
|
+
listfoxfiles = infile
|
|
8647
8741
|
else:
|
|
8648
8742
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8649
8743
|
infile = RemoveWindowsPath(infile)
|
|
8650
|
-
|
|
8651
|
-
if(not
|
|
8744
|
+
listfoxfiles = FoxFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8745
|
+
if(not listfoxfiles):
|
|
8652
8746
|
return False
|
|
8653
|
-
lenlist = len(
|
|
8654
|
-
fnumfiles = int(
|
|
8747
|
+
lenlist = len(listfoxfiles['ffilelist'])
|
|
8748
|
+
fnumfiles = int(listfoxfiles['fnumfiles'])
|
|
8655
8749
|
lcfi = 0
|
|
8656
|
-
lcfx = int(
|
|
8657
|
-
if(lenlist >
|
|
8750
|
+
lcfx = int(listfoxfiles['fnumfiles'])
|
|
8751
|
+
if(lenlist > listfoxfiles['fnumfiles'] or lenlist < listfoxfiles['fnumfiles']):
|
|
8658
8752
|
lcfx = int(lenlist)
|
|
8659
8753
|
else:
|
|
8660
|
-
lcfx = int(
|
|
8754
|
+
lcfx = int(listfoxfiles['fnumfiles'])
|
|
8661
8755
|
returnval = {}
|
|
8662
8756
|
while(lcfi < lcfx):
|
|
8663
|
-
returnval.update({lcfi:
|
|
8757
|
+
returnval.update({lcfi: listfoxfiles['ffilelist'][lcfi]['fname']})
|
|
8664
8758
|
if(not verbose):
|
|
8665
|
-
VerbosePrintOut(
|
|
8759
|
+
VerbosePrintOut(listfoxfiles['ffilelist'][lcfi]['fname'])
|
|
8666
8760
|
if(verbose):
|
|
8667
8761
|
permissions = {'access': {'0': ('---'), '1': ('--x'), '2': ('-w-'), '3': ('-wx'), '4': (
|
|
8668
8762
|
'r--'), '5': ('r-x'), '6': ('rw-'), '7': ('rwx')}, 'roles': {0: 'owner', 1: 'group', 2: 'other'}}
|
|
8669
|
-
printfname =
|
|
8670
|
-
if(
|
|
8671
|
-
printfname =
|
|
8672
|
-
" link to " +
|
|
8673
|
-
if(
|
|
8674
|
-
printfname =
|
|
8675
|
-
" -> " +
|
|
8676
|
-
fuprint =
|
|
8763
|
+
printfname = listfoxfiles['ffilelist'][lcfi]['fname']
|
|
8764
|
+
if(listfoxfiles['ffilelist'][lcfi]['ftype'] == 1):
|
|
8765
|
+
printfname = listfoxfiles['ffilelist'][lcfi]['fname'] + \
|
|
8766
|
+
" link to " + listfoxfiles['ffilelist'][lcfi]['flinkname']
|
|
8767
|
+
if(listfoxfiles['ffilelist'][lcfi]['ftype'] == 2):
|
|
8768
|
+
printfname = listfoxfiles['ffilelist'][lcfi]['fname'] + \
|
|
8769
|
+
" -> " + listfoxfiles['ffilelist'][lcfi]['flinkname']
|
|
8770
|
+
fuprint = listfoxfiles['ffilelist'][lcfi]['funame']
|
|
8677
8771
|
if(len(fuprint) <= 0):
|
|
8678
|
-
fuprint =
|
|
8679
|
-
fgprint =
|
|
8772
|
+
fuprint = listfoxfiles['ffilelist'][lcfi]['fuid']
|
|
8773
|
+
fgprint = listfoxfiles['ffilelist'][lcfi]['fgname']
|
|
8680
8774
|
if(len(fgprint) <= 0):
|
|
8681
|
-
fgprint =
|
|
8775
|
+
fgprint = listfoxfiles['ffilelist'][lcfi]['fgid']
|
|
8682
8776
|
if(newstyle):
|
|
8683
|
-
VerbosePrintOut(ftype_to_str(
|
|
8684
|
-
|
|
8777
|
+
VerbosePrintOut(ftype_to_str(listfoxfiles['ffilelist'][lcfi]['ftype']) + "\t" + listfoxfiles['ffilelist'][lcfi]['fcompression'] + "\t" + str(
|
|
8778
|
+
listfoxfiles['ffilelist'][lcfi]['fsize']).rjust(15) + "\t" + printfname)
|
|
8685
8779
|
else:
|
|
8686
|
-
VerbosePrintOut(PrintPermissionString(
|
|
8687
|
-
|
|
8780
|
+
VerbosePrintOut(PrintPermissionString(listfoxfiles['ffilelist'][lcfi]['fmode'], listfoxfiles['ffilelist'][lcfi]['ftype']) + " " + str(fuprint) + "/" + str(fgprint) + " " + str(
|
|
8781
|
+
listfoxfiles['ffilelist'][lcfi]['fsize']).rjust(15) + " " + datetime.datetime.utcfromtimestamp(listfoxfiles['ffilelist'][lcfi]['fmtime']).strftime('%Y-%m-%d %H:%M') + " " + printfname)
|
|
8688
8782
|
lcfi = lcfi + 1
|
|
8689
8783
|
if(returnfp):
|
|
8690
|
-
return
|
|
8784
|
+
return listfoxfiles['fp']
|
|
8691
8785
|
else:
|
|
8692
8786
|
return True
|
|
8693
8787
|
|
|
8694
8788
|
|
|
8695
8789
|
def FoxFileStringListFiles(instr, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, verbose=False, newstyle=False, returnfp=False):
|
|
8696
|
-
fp =
|
|
8790
|
+
fp = MkTempFile(instr)
|
|
8697
8791
|
listfoxfiles = FoxFileListFiles(
|
|
8698
8792
|
instr, seekstart, seekend, skipchecksum, formatspecs, seektoend, verbose, newstyle, returnfp)
|
|
8699
8793
|
return listfoxfiles
|
|
@@ -8703,7 +8797,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8703
8797
|
if(verbose):
|
|
8704
8798
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
8705
8799
|
if(infile == "-"):
|
|
8706
|
-
infile =
|
|
8800
|
+
infile = MkTempFile()
|
|
8707
8801
|
if(hasattr(sys.stdin, "buffer")):
|
|
8708
8802
|
shutil.copyfileobj(sys.stdin.buffer, infile)
|
|
8709
8803
|
else:
|
|
@@ -8828,7 +8922,7 @@ def ZipFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8828
8922
|
if(verbose):
|
|
8829
8923
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
8830
8924
|
if(infile == "-"):
|
|
8831
|
-
infile =
|
|
8925
|
+
infile = MkTempFile()
|
|
8832
8926
|
if(hasattr(sys.stdin, "buffer")):
|
|
8833
8927
|
shutil.copyfileobj(sys.stdin.buffer, infile)
|
|
8834
8928
|
else:
|
|
@@ -9224,7 +9318,7 @@ def InFileListFiles(infile, verbose=False, formatspecs=__file_format_multi_dict_
|
|
|
9224
9318
|
|
|
9225
9319
|
|
|
9226
9320
|
def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, seekstart=0, seekend=0, skipchecksum=False, checksumtype=["crc32", "crc32", "crc32"], formatspecs=__file_format_dict__, seektoend=False, verbose=False, returnfp=False):
|
|
9227
|
-
outarray =
|
|
9321
|
+
outarray = MkTempFile()
|
|
9228
9322
|
packform = PackFoxFile(infiles, outarray, dirlistfromtxt, compression, compresswholefile,
|
|
9229
9323
|
compressionlevel, followlink, checksumtype, formatspecs, False, True)
|
|
9230
9324
|
listfoxfiles = FoxFileListFiles(
|
|
@@ -9242,32 +9336,32 @@ def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32',
|
|
|
9242
9336
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9243
9337
|
|
|
9244
9338
|
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9245
|
-
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9339
|
+
return MakeEmptyFile(outfile, fmttype, "auto", False, None, compressionlistalt, checksumtype, formatspecs, returnfp)
|
|
9246
9340
|
|
|
9247
9341
|
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9248
9342
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9249
9343
|
|
|
9250
9344
|
def pack_neo(infiles, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], encoding="UTF-8", compression="auto", compression_level=None, returnfp=False):
|
|
9251
|
-
return
|
|
9345
|
+
return PackArchiveFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9252
9346
|
|
|
9253
9347
|
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9254
|
-
return
|
|
9348
|
+
return ArchiveFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9255
9349
|
|
|
9256
9350
|
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9257
|
-
return
|
|
9351
|
+
return UnPackArchiveFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9258
9352
|
|
|
9259
9353
|
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9260
|
-
return
|
|
9354
|
+
return RePackArchiveFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9261
9355
|
|
|
9262
9356
|
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9263
|
-
return
|
|
9357
|
+
return ArchiveFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9264
9358
|
|
|
9265
9359
|
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9266
|
-
return
|
|
9360
|
+
return ArchiveFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9267
9361
|
|
|
9268
9362
|
def convert_foreign_to_neo(infile, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9269
9363
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9270
|
-
return
|
|
9364
|
+
return RePackArchiveFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9271
9365
|
|
|
9272
9366
|
def download_file_from_ftp_file(url):
|
|
9273
9367
|
urlparts = urlparse(url)
|
|
@@ -9310,7 +9404,7 @@ def download_file_from_ftp_file(url):
|
|
|
9310
9404
|
ftp.login(urlparts.username, urlparts.password)
|
|
9311
9405
|
if(urlparts.scheme == "ftps"):
|
|
9312
9406
|
ftp.prot_p()
|
|
9313
|
-
ftpfile =
|
|
9407
|
+
ftpfile = MkTempFile()
|
|
9314
9408
|
ftp.retrbinary("RETR "+urlparts.path, ftpfile.write)
|
|
9315
9409
|
#ftp.storbinary("STOR "+urlparts.path, ftpfile.write);
|
|
9316
9410
|
ftp.close()
|
|
@@ -9371,7 +9465,7 @@ def upload_file_to_ftp_file(ftpfile, url):
|
|
|
9371
9465
|
|
|
9372
9466
|
|
|
9373
9467
|
def upload_file_to_ftp_string(ftpstring, url):
|
|
9374
|
-
ftpfileo =
|
|
9468
|
+
ftpfileo = MkTempFile(ftpstring)
|
|
9375
9469
|
ftpfile = upload_file_to_ftp_file(ftpfileo, url)
|
|
9376
9470
|
ftpfileo.close()
|
|
9377
9471
|
return ftpfile
|
|
@@ -9423,7 +9517,7 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__):
|
|
|
9423
9517
|
return download_file_from_ftp_file(url)
|
|
9424
9518
|
|
|
9425
9519
|
# Create a temporary file object
|
|
9426
|
-
httpfile =
|
|
9520
|
+
httpfile = MkTempFile()
|
|
9427
9521
|
|
|
9428
9522
|
# 1) Requests branch
|
|
9429
9523
|
if usehttp == 'requests' and haverequests:
|
|
@@ -9531,7 +9625,7 @@ if(haveparamiko):
|
|
|
9531
9625
|
log.info("Error With URL "+url)
|
|
9532
9626
|
return False
|
|
9533
9627
|
sftp = ssh.open_sftp()
|
|
9534
|
-
sftpfile =
|
|
9628
|
+
sftpfile = MkTempFile()
|
|
9535
9629
|
sftp.getfo(urlparts.path, sftpfile)
|
|
9536
9630
|
sftp.close()
|
|
9537
9631
|
ssh.close()
|
|
@@ -9601,7 +9695,7 @@ else:
|
|
|
9601
9695
|
|
|
9602
9696
|
if(haveparamiko):
|
|
9603
9697
|
def upload_file_to_sftp_string(sftpstring, url):
|
|
9604
|
-
sftpfileo =
|
|
9698
|
+
sftpfileo = MkTempFile(sftpstring)
|
|
9605
9699
|
sftpfile = upload_file_to_sftp_files(sftpfileo, url)
|
|
9606
9700
|
sftpfileo.close()
|
|
9607
9701
|
return sftpfile
|
|
@@ -9647,7 +9741,7 @@ if(havepysftp):
|
|
|
9647
9741
|
log.info("Error With URL "+url)
|
|
9648
9742
|
return False
|
|
9649
9743
|
sftp = ssh.open_sftp()
|
|
9650
|
-
sftpfile =
|
|
9744
|
+
sftpfile = MkTempFile()
|
|
9651
9745
|
sftp.getfo(urlparts.path, sftpfile)
|
|
9652
9746
|
sftp.close()
|
|
9653
9747
|
ssh.close()
|
|
@@ -9714,7 +9808,7 @@ else:
|
|
|
9714
9808
|
|
|
9715
9809
|
if(havepysftp):
|
|
9716
9810
|
def upload_file_to_pysftp_string(sftpstring, url):
|
|
9717
|
-
sftpfileo =
|
|
9811
|
+
sftpfileo = MkTempFile(sftpstring)
|
|
9718
9812
|
sftpfile = upload_file_to_pysftp_file(ftpfileo, url)
|
|
9719
9813
|
sftpfileo.close()
|
|
9720
9814
|
return sftpfile
|
|
@@ -9816,8 +9910,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9816
9910
|
|
|
9817
9911
|
|
|
9818
9912
|
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9913
|
+
internetfileo = MkTempFile(ifp)
|
|
9819
9914
|
fp = CompressOpenFileAlt(
|
|
9820
|
-
|
|
9915
|
+
internetfileo, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9821
9916
|
if(not foxfileout):
|
|
9822
9917
|
return False
|
|
9823
9918
|
fp.seek(0, 0)
|