PyFoxFile 0.27.0__py3-none-any.whl → 0.27.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.
@@ -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: foxfile.py - Last Update: 11/14/2025 Ver. 0.27.0 RC 1 - Author: cooldude2k $
17
+ $FileInfo: foxfile.py - Last Update: 11/16/2025 Ver. 0.27.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
@@ -170,11 +170,11 @@ if active_action:
170
170
  tmpout = pyfoxfile.RePackFoxFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, getargs.verbose, False)
171
171
  else:
172
172
  tmpout = pyfoxfile.PackFoxFileFromInFile(
173
- input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.insecretkey, getargs.verbose, False)
173
+ input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
174
174
  if(not tmpout):
175
175
  sys.exit(1)
176
176
  else:
177
- pyfoxfile.PackFoxFile(getargs.input, getargs.output, getargs.text, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.insecretkey, getargs.verbose, False)
177
+ pyfoxfile.PackFoxFile(getargs.input, getargs.output, getargs.text, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
178
178
  elif active_action == 'repack':
179
179
  if getargs.convert:
180
180
  checkcompressfile = pyfoxfile.CheckCompressionSubType(
@@ -183,7 +183,7 @@ if active_action:
183
183
  pyfoxfile.RePackFoxFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt,
184
184
  False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, getargs.verbose, False)
185
185
  else:
186
- pyfoxfile.PackFoxFileFromInFile(input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.insecretkey, getargs.verbose, False)
186
+ pyfoxfile.PackFoxFileFromInFile(input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
187
187
  if(not tmpout):
188
188
  sys.exit(1)
189
189
  else:
@@ -198,7 +198,7 @@ if active_action:
198
198
  tmpout = pyfoxfile.RePackFoxFile(input_file, tempout, "auto", getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, False)
199
199
  else:
200
200
  tmpout = pyfoxfile.PackFoxFileFromInFile(
201
- input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.insecretkey, False, False)
201
+ input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, False, False)
202
202
  if(not tmpout):
203
203
  sys.exit(1)
204
204
  input_file = tempout
@@ -225,7 +225,7 @@ if active_action:
225
225
  tmpout = pyfoxfile.RePackFoxFile(input_file, tempout, "auto", getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, False, False)
226
226
  else:
227
227
  tmpout = pyfoxfile.PackFoxFileFromInFile(
228
- input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.insecretkey, False, False)
228
+ input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, False, False)
229
229
  input_file = tempout
230
230
  if(not tmpout):
231
231
  sys.exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyFoxFile
3
- Version: 0.27.0
3
+ Version: 0.27.4
4
4
  Summary: A tar like file format name archivefile.
5
5
  Home-page: https://github.com/GameMaker2k/PyFoxFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyFoxFile/archive/master.tar.gz
@@ -0,0 +1,8 @@
1
+ pyfoxfile.py,sha256=-3VUOJ8UUdau9R8L-VL91hu0k2dYAXWBu0VW_-_JpKg,626625
2
+ pyfoxfile-0.27.4.data/scripts/foxfile.py,sha256=01Pf-Om8qBixLcK8U-bCL64uczHRGqUQcIFY5CKEr7A,15303
3
+ pyfoxfile-0.27.4.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
4
+ pyfoxfile-0.27.4.dist-info/METADATA,sha256=jP6cRNyzxY61ZhkVWnLrmWsnGf5828NjSdE12b9hoz4,911
5
+ pyfoxfile-0.27.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ pyfoxfile-0.27.4.dist-info/top_level.txt,sha256=VTOkpGfBWHNht7FKfnbccd32n_Jgk8Df5NKKfzaliTc,10
7
+ pyfoxfile-0.27.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
+ pyfoxfile-0.27.4.dist-info/RECORD,,
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: 11/14/2025 Ver. 0.27.0 RC 1 - Author: cooldude2k $
17
+ $FileInfo: pyfoxfile.py - Last Update: 11/16/2025 Ver. 0.27.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
@@ -47,11 +47,9 @@ except ImportError:
47
47
 
48
48
  try:
49
49
  from http.server import BaseHTTPRequestHandler, HTTPServer
50
- from socketserver import TCPServer
51
50
  from urllib.parse import urlparse, parse_qs
52
51
  except ImportError:
53
52
  from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
54
- from SocketServer import TCPServer
55
53
  from urlparse import urlparse, parse_qs
56
54
 
57
55
  try:
@@ -664,12 +662,12 @@ __project__ = __program_name__
664
662
  __program_alt_name__ = __program_name__
665
663
  __project_url__ = "https://github.com/GameMaker2k/PyFoxFile"
666
664
  __project_release_url__ = __project_url__+"/releases/latest"
667
- __version_info__ = (0, 27, 0, "RC 1", 1)
668
- __version_date_info__ = (2025, 11, 14, "RC 1", 1)
665
+ __version_info__ = (0, 27, 4, "RC 1", 1)
666
+ __version_date_info__ = (2025, 11, 16, "RC 1", 1)
669
667
  __version_date__ = str(__version_date_info__[0]) + "." + str(
670
668
  __version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
671
669
  __revision__ = __version_info__[3]
672
- __revision_id__ = "$Id: 922ba385fbf9784e38aef32e660e695e81aee4bf $"
670
+ __revision_id__ = "$Id: 91a0d1eaee5a60c54db95564f2b9f9d799a1ccf5 $"
673
671
  if(__version_info__[4] is not None):
674
672
  __version_date_plusrc__ = __version_date__ + \
675
673
  "-" + str(__version_date_info__[4])
@@ -885,16 +883,14 @@ try:
885
883
  try:
886
884
  import compression.lzma as lzma
887
885
  except ImportError:
888
- import lzma
886
+ try:
887
+ import lzma
888
+ except ImportError:
889
+ from backports import lzma
889
890
  compressionsupport.append("lzma")
890
891
  compressionsupport.append("xz")
891
892
  except ImportError:
892
- try:
893
- from backports import lzma
894
- compressionsupport.append("lzma")
895
- compressionsupport.append("xz")
896
- except ImportError:
897
- pass
893
+ pass
898
894
  try:
899
895
  try:
900
896
  import compression.zlib as zlib
@@ -6503,16 +6499,29 @@ def AppendFilesWithContentToList(infiles, dirlistfromtxt=False, extradata=[], js
6503
6499
  advancedlist = __use_advanced_list__
6504
6500
  altinode = __use_alt_inode__
6505
6501
  infilelist = []
6506
- if(infiles == "-"):
6502
+ if(not dirlistfromtxt and not isinstance(infiles, (list, tuple, )) and infiles == "-"):
6507
6503
  for line in PY_STDIN_TEXT:
6508
6504
  infilelist.append(line.strip())
6509
6505
  infilelist = list(filter(None, infilelist))
6510
- elif(infiles != "-" and dirlistfromtxt and os.path.exists(infiles) and (os.path.isfile(infiles) or infiles == os.devnull)):
6511
- if(not os.path.exists(infiles) or not os.path.isfile(infiles)):
6512
- return False
6513
- with UncompressFile(infiles, formatspecs, "r") as finfile:
6514
- for line in finfile:
6515
- infilelist.append(line.strip())
6506
+ if(not dirlistfromtxt and isinstance(infiles, (list, tuple, )) and len(infiles)==1 and infiles[0] == "-"):
6507
+ for line in PY_STDIN_TEXT:
6508
+ infilelist.append(line.strip())
6509
+ infilelist = list(filter(None, infilelist))
6510
+ elif(dirlistfromtxt):
6511
+ if(not isinstance(infiles, (list, tuple, ))):
6512
+ infiles = [infiles]
6513
+ if(isinstance(infiles, (list, tuple, ))):
6514
+ for fileloc in infiles:
6515
+ if(fileloc == "-"):
6516
+ for line in PY_STDIN_TEXT:
6517
+ infilelist.append(line.strip())
6518
+ else:
6519
+ if(not os.path.exists(fileloc) or not os.path.isfile(fileloc)):
6520
+ return False
6521
+ else:
6522
+ with UncompressFile(fileloc, formatspecs, "r") as finfile:
6523
+ for line in finfile:
6524
+ infilelist.append(line.strip())
6516
6525
  infilelist = list(filter(None, infilelist))
6517
6526
  else:
6518
6527
  if(isinstance(infiles, (list, tuple, ))):
@@ -6848,7 +6857,7 @@ def AppendFilesWithContentFromTarFileToList(infile, extradata=[], jsondata={}, c
6848
6857
  inodetofile = {}
6849
6858
  filetoinode = {}
6850
6859
  inodetoforminode = {}
6851
- if(infile == "-"):
6860
+ if(not isinstance(infile, (list, tuple, )) and infile == "-"):
6852
6861
  infile = MkTempFile()
6853
6862
  shutil.copyfileobj(PY_STDIN_BUF, infile, length=__filebuff_size__)
6854
6863
  infile.seek(0, 0)
@@ -6916,7 +6925,7 @@ def AppendFilesWithContentFromTarFileToList(infile, extradata=[], jsondata={}, c
6916
6925
  fblocks = 0
6917
6926
  fflags = 0
6918
6927
  ftype = 0
6919
- if(member.isreg()):
6928
+ if(member.isreg() or member.isfile()):
6920
6929
  ffullmode = member.mode + stat.S_IFREG
6921
6930
  ftype = 0
6922
6931
  elif(member.islnk()):
@@ -7074,7 +7083,7 @@ def AppendFilesWithContentFromZipFileToList(infile, extradata=[], jsondata={}, c
7074
7083
  inodetofile = {}
7075
7084
  filetoinode = {}
7076
7085
  inodetoforminode = {}
7077
- if(infile == "-"):
7086
+ if(not isinstance(infile, (list, tuple, )) and infile == "-"):
7078
7087
  infile = MkTempFile()
7079
7088
  shutil.copyfileobj(PY_STDIN_BUF, infile, length=__filebuff_size__)
7080
7089
  infile.seek(0, 0)
@@ -7121,9 +7130,13 @@ def AppendFilesWithContentFromZipFileToList(infile, extradata=[], jsondata={}, c
7121
7130
  ftype = 0
7122
7131
  if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
7123
7132
  ftype = 5
7133
+ elif ((hasattr(member, "symlink") and member.symlink())):
7134
+ ftype = 2
7124
7135
  else:
7125
7136
  ftype = 0
7126
7137
  flinkname = ""
7138
+ if(ftype==2):
7139
+ flinkname = zipfp.read(member.filename).decode("UTF-8")
7127
7140
  fcurfid = format(int(curfid), 'x').lower()
7128
7141
  fcurinode = format(int(curfid), 'x').lower()
7129
7142
  curfid = curfid + 1
@@ -7149,6 +7162,10 @@ def AppendFilesWithContentFromZipFileToList(infile, extradata=[], jsondata={}, c
7149
7162
  fmode = format(int(stat.S_IFDIR | 0x1ff), 'x').lower()
7150
7163
  fchmode = stat.S_IMODE(int(stat.S_IFDIR | 0x1ff))
7151
7164
  ftypemod = stat.S_IFMT(int(stat.S_IFDIR | 0x1ff))
7165
+ elif ((hasattr(member, "symlink") and member.symlink()) or member.filename.endswith('/')):
7166
+ fmode = format(int(stat.S_IFREG | 0x1b6), 'x').lower()
7167
+ fchmode = stat.S_IMODE(int(stat.S_IFREG | 0x1b6))
7168
+ ftypemod = stat.S_IFMT(int(stat.S_IFREG | 0x1b6))
7152
7169
  else:
7153
7170
  fmode = format(int(stat.S_IFREG | 0x1b6), 'x').lower()
7154
7171
  fchmode = stat.S_IMODE(int(stat.S_IFREG | 0x1b6))
@@ -7157,6 +7174,17 @@ def AppendFilesWithContentFromZipFileToList(infile, extradata=[], jsondata={}, c
7157
7174
  fwinattributes = format(int(zipinfo.external_attr & 0xFFFF), 'x').lower()
7158
7175
  fmode = format(int((zipinfo.external_attr >> 16) & 0xFFFF), 'x').lower()
7159
7176
  prefmode = int((zipinfo.external_attr >> 16) & 0xFFFF)
7177
+ if(prefmode==0):
7178
+ fmode = 0
7179
+ prefmode = 0
7180
+ else:
7181
+ file_type = prefmode & 0xF000
7182
+ if(file_type not in (stat.S_IFREG, stat.S_IFDIR, stat.S_IFLNK)):
7183
+ fmode = 0
7184
+ prefmode = 0
7185
+ if((mode & 0x1FF) == 0):
7186
+ fmode = 0
7187
+ prefmode = 0
7160
7188
  if (prefmode == 0):
7161
7189
  if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
7162
7190
  fmode = format(int(stat.S_IFDIR | 0x1ff), 'x').lower()
@@ -7603,7 +7631,10 @@ else:
7603
7631
  fpremode = int(stat.S_IFREG | 0x1b6)
7604
7632
  elif(member.is_directory):
7605
7633
  fpremode = int(stat.S_IFDIR | 0x1ff)
7606
- fwinattributes = format(int(0), 'x').lower()
7634
+ try:
7635
+ fwinattributes = format(int(member.attributes & 0xFFFF), 'x').lower()
7636
+ except AttributeError:
7637
+ fwinattributes = format(int(0), 'x').lower()
7607
7638
  fcompression = ""
7608
7639
  fcsize = format(int(0), 'x').lower()
7609
7640
  flinkcount = 0
@@ -7639,6 +7670,13 @@ else:
7639
7670
  int(stat.S_IMODE(int(stat.S_IFREG | 0x1b6))), 'x').lower()
7640
7671
  ftypemod = format(
7641
7672
  int(stat.S_IFMT(int(stat.S_IFREG | 0x1b6))), 'x').lower()
7673
+ try:
7674
+ ffullmode = member.posix_mode
7675
+ fmode = format(int(ffullmode), 'x').lower()
7676
+ fchmode = format(int(stat.S_IMODE(ffullmode)), 'x').lower()
7677
+ ftypemod = format(int(stat.S_IFMT(ffullmode)), 'x').lower()
7678
+ except AttributeError:
7679
+ pass
7642
7680
  try:
7643
7681
  fuid = format(int(os.getuid()), 'x').lower()
7644
7682
  except (KeyError, AttributeError):
@@ -10204,7 +10242,7 @@ def FoxFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
10204
10242
  if(not fp):
10205
10243
  return False
10206
10244
  fp.seek(filestart, 0)
10207
- elif(infile == "-"):
10245
+ elif(not isinstance(infile, (list, tuple, )) and infile == "-"):
10208
10246
  fp = MkTempFile()
10209
10247
  shutil.copyfileobj(PY_STDIN_BUF, fp, length=__filebuff_size__)
10210
10248
  fp.seek(filestart, 0)
@@ -11580,8 +11618,8 @@ def FoxFileStringListFiles(instr, filestart=0, seekstart=0, seekend=0, skipcheck
11580
11618
  return listarrayfiles
11581
11619
 
11582
11620
 
11583
- def TarFileListFiles(infile, verbose=False, returnfp=False):
11584
- if(infile == "-"):
11621
+ def TarFileListFiles(infile, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
11622
+ if(not isinstance(infile, (list, tuple, )) and infile == "-"):
11585
11623
  infile = MkTempFile()
11586
11624
  shutil.copyfileobj(PY_STDIN_BUF, infile, length=__filebuff_size__)
11587
11625
  infile.seek(0, 0)
@@ -11641,7 +11679,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
11641
11679
  ffullmode = member.mode
11642
11680
  flinkcount = 0
11643
11681
  ftype = 0
11644
- if(member.isreg()):
11682
+ if(member.isreg() or member.isfile()):
11645
11683
  ffullmode = member.mode + stat.S_IFREG
11646
11684
  ftype = 0
11647
11685
  elif(member.islnk()):
@@ -11696,8 +11734,12 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
11696
11734
  return True
11697
11735
 
11698
11736
 
11737
+ def TarFileListFile(infile, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
11738
+ return TarFileListFiles(infile, formatspecs, verbose, returnfp)
11739
+
11740
+
11699
11741
  def ZipFileListFiles(infile, verbose=False, returnfp=False):
11700
- if(infile == "-"):
11742
+ if(not isinstance(infile, (list, tuple, )) and infile == "-"):
11701
11743
  infile = MkTempFile()
11702
11744
  shutil.copyfileobj(PY_STDIN_BUF, infile, length=__filebuff_size__)
11703
11745
  infile.seek(0, 0)
@@ -11728,35 +11770,59 @@ def ZipFileListFiles(infile, verbose=False, returnfp=False):
11728
11770
  for member in sorted(zipfp.infolist(), key=lambda x: x.filename):
11729
11771
  zipinfo = zipfp.getinfo(member.filename)
11730
11772
  if(zipinfo.create_system == 0 or zipinfo.create_system == 10):
11731
- fwinattributes = int(zipinfo.external_attr)
11773
+ fwinattributes = int(zipinfo.external_attr & 0xFFFF)
11732
11774
  if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
11733
11775
  fmode = int(stat.S_IFDIR | 0x1ff)
11734
- fchmode = int(stat.S_IMODE(int(stat.S_IFDIR | 0x1ff)))
11735
- ftypemod = int(stat.S_IFMT(int(stat.S_IFDIR | 0x1ff)))
11776
+ fchmode = stat.S_IMODE(int(stat.S_IFDIR | 0x1ff))
11777
+ ftypemod = stat.S_IFMT(int(stat.S_IFDIR | 0x1ff))
11778
+ elif ((hasattr(member, "symlink") and member.symlink()) or member.filename.endswith('/')):
11779
+ fmode = int(stat.S_IFREG | 0x1b6)
11780
+ fchmode = stat.S_IMODE(int(stat.S_IFREG | 0x1b6))
11781
+ ftypemod = stat.S_IFMT(int(stat.S_IFREG | 0x1b6))
11736
11782
  else:
11737
11783
  fmode = int(stat.S_IFREG | 0x1b6)
11738
- fchmode = int(stat.S_IMODE(fmode))
11739
- ftypemod = int(stat.S_IFMT(fmode))
11784
+ fchmode = stat.S_IMODE(int(stat.S_IFREG | 0x1b6))
11785
+ ftypemod = stat.S_IFMT(int(stat.S_IFREG | 0x1b6))
11740
11786
  elif(zipinfo.create_system == 3):
11741
- fwinattributes = int(0)
11742
- try:
11743
- fmode = int(zipinfo.external_attr)
11744
- fchmode = stat.S_IMODE(fmode)
11745
- ftypemod = stat.S_IFMT(fmode)
11746
- except OverflowError:
11747
- fmode = int(zipinfo.external_attr >> 16)
11748
- fchmode = stat.S_IMODE(fmode)
11749
- ftypemod = stat.S_IFMT(fmode)
11787
+ fwinattributes = int(zipinfo.external_attr & 0xFFFF)
11788
+ fmode = int((zipinfo.external_attr >> 16) & 0xFFFF)
11789
+ prefmode = int((zipinfo.external_attr >> 16) & 0xFFFF)
11790
+ if(prefmode==0):
11791
+ fmode = 0
11792
+ prefmode = 0
11793
+ else:
11794
+ file_type = prefmode & 0xF000
11795
+ if(file_type not in (stat.S_IFREG, stat.S_IFDIR, stat.S_IFLNK)):
11796
+ fmode = 0
11797
+ prefmode = 0
11798
+ if((mode & 0x1FF) == 0):
11799
+ fmode = 0
11800
+ prefmode = 0
11801
+ if (prefmode == 0):
11802
+ if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
11803
+ fmode = int(stat.S_IFDIR | 0x1ff)
11804
+ prefmode = int(stat.S_IFDIR | 0x1ff)
11805
+ fchmode = stat.S_IMODE(prefmode)
11806
+ ftypemod = stat.S_IFMT(prefmode)
11807
+ else:
11808
+ fmode = int(stat.S_IFREG | 0x1b6)
11809
+ prefmode = int(stat.S_IFREG | 0x1b6)
11810
+ fchmode = stat.S_IMODE(prefmode)
11811
+ ftypemod = stat.S_IFMT(prefmode)
11812
+ fchmode = stat.S_IMODE(prefmode)
11813
+ ftypemod = stat.S_IFMT(prefmode)
11750
11814
  else:
11751
- fwinattributes = int(0)
11815
+ fwinattributes = int(zipinfo.external_attr & 0xFFFF)
11752
11816
  if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
11753
11817
  fmode = int(stat.S_IFDIR | 0x1ff)
11754
- fchmode = int(stat.S_IMODE(int(stat.S_IFDIR | 0x1ff)))
11755
- ftypemod = int(stat.S_IFMT(int(stat.S_IFDIR | 0x1ff)))
11818
+ prefmode = int(stat.S_IFDIR | 0x1ff)
11819
+ fchmode = stat.S_IMODE(prefmode)
11820
+ ftypemod = stat.S_IFMT(prefmode)
11756
11821
  else:
11757
11822
  fmode = int(stat.S_IFREG | 0x1b6)
11758
- fchmode = int(stat.S_IMODE(fmode))
11759
- ftypemod = int(stat.S_IFMT(fmode))
11823
+ prefmode = int(stat.S_IFREG | 0x1b6)
11824
+ fchmode = stat.S_IMODE(prefmode)
11825
+ ftypemod = stat.S_IFMT(prefmode)
11760
11826
  returnval.update({lcfi: member.filename})
11761
11827
  if(not verbose):
11762
11828
  VerbosePrintOut(member.filename)
@@ -11770,10 +11836,17 @@ def ZipFileListFiles(infile, verbose=False, returnfp=False):
11770
11836
  if ((hasattr(member, "is_dir") and member.is_dir()) or member.filename.endswith('/')):
11771
11837
  ftype = 5
11772
11838
  permissionstr = "d" + permissionstr
11839
+ elif ((hasattr(member, "symlink") and member.symlink())):
11840
+ ftype = 2
11841
+ permissionstr = "l" + permissionstr
11773
11842
  else:
11774
11843
  ftype = 0
11775
11844
  permissionstr = "-" + permissionstr
11776
11845
  printfname = member.filename
11846
+ if(ftype==2):
11847
+ flinkname = zipfp.read(member.filename).decode("UTF-8")
11848
+ if(ftype==2):
11849
+ printfname = member.filename + " -> " + flinkname
11777
11850
  try:
11778
11851
  fuid = int(os.getuid())
11779
11852
  except (KeyError, AttributeError):
@@ -11816,6 +11889,10 @@ def ZipFileListFiles(infile, verbose=False, returnfp=False):
11816
11889
  return True
11817
11890
 
11818
11891
 
11892
+ def ZipFileListFile(infile, verbose=False, returnfp=False):
11893
+ return ZipFileListFiles(infile, verbose, returnfp)
11894
+
11895
+
11819
11896
  if(not rarfile_support):
11820
11897
  def RarFileListFiles(infile, verbose=False, returnfp=False):
11821
11898
  return False
@@ -11943,6 +12020,11 @@ if(rarfile_support):
11943
12020
  else:
11944
12021
  return True
11945
12022
 
12023
+
12024
+ def RarFileListFile(infile, verbose=False, returnfp=False):
12025
+ return RarFileListFiles(infile, verbose, returnfp)
12026
+
12027
+
11946
12028
  if(not py7zr_support):
11947
12029
  def SevenZipFileListFiles(infile, verbose=False, returnfp=False):
11948
12030
  return False
@@ -11980,6 +12062,13 @@ if(py7zr_support):
11980
12062
  fmode = int(stat.S_IFLNK | 0x1b6)
11981
12063
  fchmode = int(stat.S_IMODE(int(stat.S_IFLNK | 0x1b6)))
11982
12064
  ftypemod = int(stat.S_IFMT(int(stat.S_IFLNK | 0x1b6)))
12065
+ try:
12066
+ ffullmode = member.posix_mode
12067
+ fmode = format(int(ffullmode), 'x').lower()
12068
+ fchmode = format(int(stat.S_IMODE(ffullmode)), 'x').lower()
12069
+ ftypemod = format(int(stat.S_IFMT(ffullmode)), 'x').lower()
12070
+ except AttributeError:
12071
+ pass
11983
12072
  returnval.update({lcfi: member.filename})
11984
12073
  if(not verbose):
11985
12074
  VerbosePrintOut(member.filename)
@@ -12047,12 +12136,16 @@ if(py7zr_support):
12047
12136
  return True
12048
12137
 
12049
12138
 
12139
+ def SevenZipFileListFile(infile, verbose=False, returnfp=False):
12140
+ return SevenZipFileListFiles(infile, verbose, returnfp)
12141
+
12142
+
12050
12143
  def InFileListFiles(infile, verbose=False, formatspecs=__file_format_multi_dict__, seektoend=False, newstyle=False, returnfp=False):
12051
12144
  checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True)
12052
12145
  if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
12053
12146
  formatspecs = formatspecs[checkcompressfile]
12054
12147
  if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
12055
- return TarFileListFiles(infile, verbose, returnfp)
12148
+ return TarFileListFiles(infile, formatspecs, verbose, returnfp)
12056
12149
  elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
12057
12150
  return ZipFileListFiles(infile, verbose, returnfp)
12058
12151
  elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
@@ -12066,6 +12159,10 @@ def InFileListFiles(infile, verbose=False, formatspecs=__file_format_multi_dict_
12066
12159
  return False
12067
12160
 
12068
12161
 
12162
+ def InFileListFile(infile, verbose=False, formatspecs=__file_format_multi_dict__, seektoend=False, newstyle=False, returnfp=False):
12163
+ return InFileListFiles(infile, verbose, formatspecs, seektoend, newstyle, returnfp)
12164
+
12165
+
12069
12166
  def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, seekstart=0, seekend=0, skipchecksum=False, checksumtype=["md5", "md5", "md5"], formatspecs=__file_format_dict__, seektoend=False, verbose=False, returnfp=False):
12070
12167
  outarray = MkTempFile()
12071
12168
  packform = PackFoxFile(infiles, outarray, dirlistfromtxt, compression, compresswholefile,
@@ -12074,6 +12171,11 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
12074
12171
  outarray, seekstart, seekend, skipchecksum, formatspecs, seektoend, verbose, returnfp)
12075
12172
  return listarrayfiles
12076
12173
 
12174
+
12175
+ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, seekstart=0, seekend=0, skipchecksum=False, checksumtype=["md5", "md5", "md5"], formatspecs=__file_format_dict__, seektoend=False, verbose=False, returnfp=False):
12176
+ return ListDirListFiles(infiles, dirlistfromtxt, compression, compresswholefile, compressionlevel, followlink, seekstart, seekend, skipchecksum, checksumtype, formatspecs, seektoend, verbose, returnfp)
12177
+
12178
+
12077
12179
  def detect_cwd(ftp, file_dir):
12078
12180
  """
12079
12181
  Test whether cwd into file_dir works. Returns True if it does,
@@ -1,130 +0,0 @@
1
- #!python
2
- # -*- coding: utf-8 -*-
3
- from __future__ import absolute_import, division, print_function, unicode_literals
4
-
5
- import sys, os, io, argparse
6
-
7
- try:
8
- import pyfoxfile as P # core must provide *_neo functions
9
- except Exception as e:
10
- sys.stderr.write("Failed to import core module 'pyfoxfile': %s\n" % (e,))
11
- sys.exit(2)
12
-
13
-
14
- def _expand_combined_short_opts(argv):
15
- out = [argv[0]]
16
- i = 1
17
- while i < len(argv):
18
- a = argv[i]
19
- if a.startswith("--") or not (a.startswith("-") and len(a) > 2):
20
- out.append(a); i += 1; continue
21
- for ch in a[1:]:
22
- out.append("-" + ch)
23
- i += 1
24
- return out
25
-
26
-
27
- def main():
28
- argv = _expand_combined_short_opts(sys.argv)
29
-
30
- p = argparse.ArgumentParser(
31
- description="PyNeoFile CLI (uses pyfoxfile core)")
32
- g = p.add_mutually_exclusive_group(required=True)
33
- g.add_argument("-l", "--list", action="store_true", help="List archive")
34
- g.add_argument("-e", "--extract", action="store_true", help="Extract archive")
35
- g.add_argument("-c", "--create", action="store_true", help="Create archive from path")
36
- g.add_argument("-r", "--repack", action="store_true", help="Repack (recompress) an archive")
37
- g.add_argument("-E", "--empty", action="store_true", help="Create an empty archive")
38
-
39
- p.add_argument("-i", "--input", help="Input file/path", nargs="*")
40
- p.add_argument("-o", "--output", help="Output file/dir (or '-' for stdout)")
41
- p.add_argument("-d", "--verbose", action="store_true", help="Verbose/detailed listing")
42
- p.add_argument("-P", "--compression", default="auto", help="Compression algo (auto, none, zlib, gzip, bz2, lzma)")
43
- p.add_argument("-L", "--level", type=int, default=None, help="Compression level/preset")
44
- p.add_argument("--checksum", default="crc32", help="Checksum type for header/content/json (default: crc32)")
45
-
46
- args = p.parse_args(argv[1:])
47
-
48
- src = None
49
- if args.input:
50
- if isinstance(args.input, list) and len(args.input) == 1:
51
- src = args.input[0]
52
- elif isinstance(args.input, list) and len(args.input) > 1:
53
- src = args.input[0]
54
- else:
55
- src = args.input
56
-
57
- if args.empty:
58
- dst = args.output or "-"
59
- blob_or_true = P.make_empty_file_neo(dst, fmttype="auto", checksumtype=args.checksum, encoding="UTF-8", returnfp=False)
60
- if dst in (None, "-"):
61
- data = blob_or_true if isinstance(blob_or_true, (bytes, bytearray)) else b""
62
- if hasattr(sys.stdout, "buffer"):
63
- sys.stdout.buffer.write(data)
64
- else:
65
- sys.stdout.write(data.decode("latin1"))
66
- return 0
67
-
68
- if args.list:
69
- if not src:
70
- p.error("list requires -i <archive>")
71
- P.archivefilelistfiles_neo(src, advanced=args.verbose, include_dirs=True)
72
- return 0
73
-
74
- if args.extract:
75
- if not src:
76
- p.error("extract requires -i <archive>")
77
- outdir = args.output or "."
78
- ok = P.unpack_neo(src, outdir, skipchecksum=False, uncompress=True)
79
- return 0 if ok else 1
80
-
81
- if args.create:
82
- if not src:
83
- p.error("create requires -i <path>")
84
- if args.verbose:
85
- walkroot = src
86
- if os.path.isdir(walkroot):
87
- print(walkroot)
88
- for root, dirs, files in os.walk(walkroot):
89
- relroot = root if root.startswith("./") else "./" + root.replace("\\", "/")
90
- if root != walkroot:
91
- print(relroot)
92
- for name in sorted(files):
93
- path = os.path.join(root, name).replace("\\", "/")
94
- if not path.startswith("./"):
95
- path = "./" + path
96
- print(path)
97
- else:
98
- path = src if src.startswith("./") else "./" + src
99
- print(path)
100
-
101
- outpath = args.output or "-"
102
- ok = P.pack_neo(src, outpath, checksumtypes=(args.checksum,args.checksum,args.checksum,args.checksum),
103
- encoding="UTF-8", compression=args.compression, compression_level=args.level)
104
- if outpath in (None, "-") and isinstance(ok, (bytes, bytearray)):
105
- if hasattr(sys.stdout, "buffer"):
106
- sys.stdout.buffer.write(ok)
107
- else:
108
- sys.stdout.write(ok.decode("latin1"))
109
- return 0
110
- return 0 if ok else 1
111
-
112
- if args.repack:
113
- if not src:
114
- p.error("repack requires -i <archive>")
115
- outpath = args.output or "-"
116
- ok = P.repack_neo(src, outpath, checksumtypes=(args.checksum,args.checksum,args.checksum,args.checksum),
117
- compression=args.compression, compression_level=args.level)
118
- if outpath in (None, "-") and isinstance(ok, (bytes, bytearray)):
119
- if hasattr(sys.stdout, "buffer"):
120
- sys.stdout.buffer.write(ok)
121
- else:
122
- sys.stdout.write(ok.decode("latin1"))
123
- return 0
124
- return 0 if ok else 1
125
-
126
- return 0
127
-
128
-
129
- if __name__ == "__main__":
130
- sys.exit(main())
@@ -1,136 +0,0 @@
1
- #!python
2
- # -*- coding: utf-8 -*-
3
-
4
- '''
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the Revised BSD License.
7
-
8
- This program is distributed in the hope that it will be useful,
9
- but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- Revised BSD License for more details.
12
-
13
- Copyright 2018-2024 Cool Dude 2k - http://idb.berlios.de/
14
- Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
15
- Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16
-
17
- $FileInfo: neofoxfile.py - Last Update: 8/26/2025 Ver. 0.21.4 RC 1 - Author: cooldude2k $
18
- '''
19
-
20
- from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
21
- import argparse
22
- import pyfoxfile
23
-
24
- __project__ = pyfoxfile.__project__
25
- __program_name__ = pyfoxfile.__program_name__
26
- __file_format_name__ = pyfoxfile.__file_format_name__
27
- __file_format_magic__ = pyfoxfile.__file_format_magic__
28
- __file_format_len__ = pyfoxfile.__file_format_len__
29
- __file_format_hex__ = pyfoxfile.__file_format_hex__
30
- __file_format_delimiter__ = pyfoxfile.__file_format_delimiter__
31
- __file_format_dict__ = pyfoxfile.__file_format_dict__
32
- __file_format_default__ = pyfoxfile.__file_format_default__
33
- __use_new_style__ = pyfoxfile.__use_new_style__
34
- __use_advanced_list__ = pyfoxfile.__use_advanced_list__
35
- __use_alt_inode__ = pyfoxfile.__use_alt_inode__
36
- __project_url__ = pyfoxfile.__project_url__
37
- __version_info__ = pyfoxfile.__version_info__
38
- __version_date_info__ = pyfoxfile.__version_date_info__
39
- __version_date__ = pyfoxfile.__version_date__
40
- __version_date_plusrc__ = pyfoxfile.__version_date_plusrc__
41
- __version__ = pyfoxfile.__version__
42
-
43
- # Compatibility layer for Python 2 and 3 input
44
- try:
45
- input = raw_input
46
- except NameError:
47
- pass
48
-
49
- # Determine if rar file support is enabled
50
- rarfile_support = pyfoxfile.rarfile_support
51
- py7zr_support = pyfoxfile.py7zr_support
52
-
53
- # Set up the argument parser
54
- argparser = argparse.ArgumentParser(
55
- description="Manipulates archive files for various operations like creation, extraction, and validation.")
56
- argparser.add_argument("-V", "--version", action="version", version="{0} {1}".format(
57
- __program_name__, __version__), help="Displays the program's version.")
58
- argparser.add_argument("-i", "--input", nargs="+", required=True,
59
- help="Specifies input file(s) for processing.")
60
- argparser.add_argument(
61
- "-o", "--output", help="Specifies the output file name.")
62
- argparser.add_argument("-d", "--verbose", action="store_true",
63
- help="Enables verbose mode for detailed information.")
64
- argparser.add_argument("-c", "--create", action="store_true",
65
- help="Creates a new archive file from input.")
66
- argparser.add_argument("-e", "--extract", action="store_true",
67
- help="Extracts files from a archive archive.")
68
- argparser.add_argument("-l", "--list", action="store_true",
69
- help="Lists contents of a specified archive file.")
70
- argparser.add_argument("-r", "--repack", action="store_true",
71
- help="Repacks an existing archive file.")
72
- argparser.add_argument("-v", "--validate", action="store_true",
73
- help="Validates a archive file's integrity.")
74
- argparser.add_argument("--checksum", default="crc32",
75
- help="Specifies the checksum type (default: crc32).")
76
- argparser.add_argument("--compression", default="auto",
77
- help="Specifies the compression method (default: auto).")
78
- argparser.add_argument("--level", help="Specifies the compression level.")
79
- argparser.add_argument("--preserve", action="store_true",
80
- help="Preserves file attributes when extracting.")
81
- argparser.add_argument("--convert", choices=['tar', 'zip', '7zip', 'rar'],
82
- help="Convert from an archive format (tar, zip, 7zip, rar) to a archive file.")
83
- args = argparser.parse_args()
84
-
85
- # Determine the primary action based on user input
86
- primary_action = None
87
- if args.create:
88
- primary_action = 'create'
89
- elif args.repack:
90
- primary_action = 'repack'
91
- elif args.extract:
92
- primary_action = 'extract'
93
- elif args.list:
94
- primary_action = 'list'
95
- elif args.validate:
96
- primary_action = 'validate'
97
- input_file = args.input[0]
98
- # Functionality mappings
99
- if primary_action == 'create':
100
- if args.convert == 'tar':
101
- pyfoxfile.PackFoxFileFromTarFile(input_file, args.output, args.compression, args.level, pyfoxfile.compressionlistalt, [args.checksum, args.checksum, args.checksum, args.checksum], [
102
- ], pyfoxfile.__file_format_dict__, args.verbose, False)
103
- elif args.convert == 'zip':
104
- pyfoxfile.PackFoxFileFromZipFile(input_file, args.output, args.compression, args.level, pyfoxfile.compressionlistalt, [args.checksum, args.checksum, args.checksum, args.checksum], [
105
- ], pyfoxfile.__file_format_dict__, args.verbose, False)
106
- elif py7zr_support and args.convert == '7zip':
107
- pyfoxfile.PackFoxFileFromSevenZipFile(input_file, args.output, args.compression, args.level, pyfoxfile.compressionlistalt, [args.checksum, args.checksum, args.checksum, args.checksum], [
108
- ], pyfoxfile.__file_format_dict__, args.verbose, False)
109
- elif rarfile_support and args.convert == 'rar':
110
- pyfoxfile.PackFoxFileFromRarFile(input_file, args.output, args.compression, args.level, pyfoxfile.compressionlistalt, [args.checksum, args.checksum, args.checksum, args.checksum], [
111
- ], pyfoxfile.__file_format_dict__, args.verbose, False)
112
- else:
113
- pyfoxfile.PackFoxFile(args.input, args.output, args.verbose, args.compression, args.level, pyfoxfile.compressionlistalt,
114
- False, [args.checksum, args.checksum, args.checksum, args.checksum], [], {}, pyfoxfile.__file_format_dict__, args.verbose, False)
115
- elif primary_action == 'repack':
116
- pyfoxfile.RePackFoxFile(
117
- input_file, args.output, args.compression, args.level, pyfoxfile.compressionlistalt, [args.checksum, args.checksum, args.checksum, args.checksum], False, args.verbose)
118
- elif primary_action == 'extract':
119
- pyfoxfile.UnPackFoxFile(
120
- input_file, args.output, False, args.verbose, args.preserve)
121
- elif primary_action == 'list':
122
- if args.convert == 'tar':
123
- pyfoxfile.TarFileListFiles(input_file, verbose=args.verbose)
124
- elif args.convert == 'zip':
125
- pyfoxfile.ZipFileListFiles(input_file, verbose=args.verbose)
126
- elif args.convert == '7zip':
127
- pyfoxfile.SevenZipFileListFiles(input_file, verbose=args.verbose)
128
- elif rarfile_support and args.convert == 'rar':
129
- pyfoxfile.RarFileListFiles(input_file, verbose=args.verbose)
130
- else:
131
- pyfoxfile.FoxFileListFiles(input_file, verbose=args.verbose)
132
- elif primary_action == 'validate':
133
- is_valid = pyfoxfile.FoxFileValidate(input_file, verbose=args.verbose)
134
- result_msg = "Validation result for {0}: {1}".format(
135
- input_file, 'Valid' if is_valid else 'Invalid')
136
- print(result_msg)
@@ -1,10 +0,0 @@
1
- pyfoxfile.py,sha256=OAHNi0KgA41BEMKdOsZgBDWOdfQKG4n5yYlvsaW8uyw,621243
2
- pyfoxfile-0.27.0.data/scripts/foxfile.py,sha256=GKNk1ACcl7clGfM7yZ42xK5HuZk_mwjW8ds0ix0tVKY,15298
3
- pyfoxfile-0.27.0.data/scripts/foxneofile.py,sha256=vrQsZFkSyq5TqQmakzz3AtvxAqQTECTcb9JTzWYDzng,5128
4
- pyfoxfile-0.27.0.data/scripts/neofoxfile.py,sha256=axk89rmrILol-ZNoTVj0wtTVvt8E_ovrq1oojSQKUj8,7114
5
- pyfoxfile-0.27.0.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
6
- pyfoxfile-0.27.0.dist-info/METADATA,sha256=Jr0QQwiIEh1gsic-TFT4SiNp8xKcxJUDQHo3ollH3UQ,911
7
- pyfoxfile-0.27.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- pyfoxfile-0.27.0.dist-info/top_level.txt,sha256=VTOkpGfBWHNht7FKfnbccd32n_Jgk8Df5NKKfzaliTc,10
9
- pyfoxfile-0.27.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
- pyfoxfile-0.27.0.dist-info/RECORD,,