PyCatFile 0.15.12__tar.gz → 0.15.14__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCatFile
3
- Version: 0.15.12
3
+ Version: 0.15.14
4
4
  Summary: A tar like file format name catfile after unix cat command (concatenate files) .
5
5
  Home-page: https://github.com/GameMaker2k/PyCatFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCatFile
3
- Version: 0.15.12
3
+ Version: 0.15.14
4
4
  Summary: A tar like file format name catfile after unix cat command (concatenate files) .
5
5
  Home-page: https://github.com/GameMaker2k/PyCatFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
@@ -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: catfile.py - Last Update: 12/20/2024 Ver. 0.15.12 RC 1 - Author: cooldude2k $
17
+ $FileInfo: catfile.py - Last Update: 12/21/2024 Ver. 0.15.14 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
@@ -98,7 +98,7 @@ argparser.add_argument("-V", "--version", action="version",
98
98
  version=__program_name__ + " " + __version__)
99
99
  # Input and output specifications
100
100
  argparser.add_argument(
101
- "-i", "--input", help="Specify the file(s) to concatenate or the concatenated file to extract.", required=True)
101
+ "-i", "--input", nargs="+", help="Specify the file(s) to concatenate or the concatenated file to extract.", required=True)
102
102
  argparser.add_argument("-o", "--output", default=None,
103
103
  help="Specify the name for the extracted or output concatenated files.")
104
104
  # Operations
@@ -161,19 +161,20 @@ fnamedict = {'format_name': fname, 'format_magic': fnamemagic, 'format_lower': f
161
161
  actions = ['create', 'extract', 'list', 'repack', 'validate']
162
162
  active_action = next(
163
163
  (action for action in actions if getattr(getargs, action)), None)
164
+ input_file = getargs.input[0]
164
165
 
165
166
  # Execute the appropriate functions based on determined actions and arguments
166
167
  if active_action:
167
168
  if active_action == 'create':
168
169
  if getargs.convert:
169
170
  checkcompressfile = pycatfile.CheckCompressionSubType(
170
- getargs.input, fnamedict, True)
171
+ input_file, fnamedict, True)
171
172
  if(checkcompressfile == "catfile"):
172
- tmpout = pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.wholefile,
173
+ tmpout = pycatfile.RePackArchiveFile(input_file, getargs.output, getargs.compression, getargs.wholefile,
173
174
  getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamedict, getargs.verbose, False)
174
175
  else:
175
176
  tmpout = pycatfile.PackArchiveFileFromInFile(
176
- getargs.input, getargs.output, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, getargs.verbose, False)
177
+ input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, getargs.verbose, False)
177
178
  if(not tmpout):
178
179
  sys.exit(1)
179
180
  else:
@@ -182,72 +183,72 @@ if active_action:
182
183
  elif active_action == 'repack':
183
184
  if getargs.convert:
184
185
  checkcompressfile = pycatfile.CheckCompressionSubType(
185
- getargs.input, fnamedict, True)
186
+ input_file, fnamedict, True)
186
187
  if(checkcompressfile == "catfile"):
187
- pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.wholefile, getargs.level,
188
+ pycatfile.RePackArchiveFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level,
188
189
  False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamedict, getargs.verbose, False)
189
190
  else:
190
- pycatfile.PackArchiveFileFromInFile(getargs.input, getargs.output, getargs.compression,
191
+ pycatfile.PackArchiveFileFromInFile(input_file, getargs.output, getargs.compression,
191
192
  getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, getargs.verbose, False)
192
193
  if(not tmpout):
193
194
  sys.exit(1)
194
195
  else:
195
- pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.wholefile, getargs.level,
196
+ pycatfile.RePackArchiveFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level,
196
197
  False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamedict, getargs.verbose, False)
197
198
  elif active_action == 'extract':
198
199
  if getargs.convert:
199
200
  checkcompressfile = pycatfile.CheckCompressionSubType(
200
- getargs.input, fnamedict, True)
201
+ input_file, fnamedict, True)
201
202
  tempout = BytesIO()
202
203
  if(checkcompressfile == "catfile"):
203
- tmpout = pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.wholefile,
204
+ tmpout = pycatfile.RePackArchiveFile(input_file, tempout, getargs.compression, getargs.wholefile,
204
205
  getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamedict, False, False)
205
206
  else:
206
207
  tmpout = pycatfile.PackArchiveFileFromInFile(
207
- getargs.input, tempout, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, False, False)
208
+ input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, False, False)
208
209
  if(not tmpout):
209
210
  sys.exit(1)
210
- getargs.input = tempout
211
- pycatfile.UnPackArchiveFile(getargs.input, getargs.output, False, 0, 0, getargs.skipchecksum,
211
+ input_file = tempout
212
+ pycatfile.UnPackArchiveFile(input_file, getargs.output, False, 0, 0, getargs.skipchecksum,
212
213
  fnamedict, getargs.verbose, getargs.preserve, getargs.preserve, False)
213
214
  elif active_action == 'list':
214
215
  if getargs.convert:
215
216
  checkcompressfile = pycatfile.CheckCompressionSubType(
216
- getargs.input, fnamedict, True)
217
+ input_file, fnamedict, True)
217
218
  if(checkcompressfile == "catfile"):
218
219
  tmpout = pycatfile.ArchiveFileListFiles(
219
- getargs.input, 0, 0, getargs.skipchecksum, fnamedict, getargs.verbose, False)
220
+ input_file, 0, 0, getargs.skipchecksum, fnamedict, getargs.verbose, False)
220
221
  else:
221
222
  tmpout = pycatfile.InFileListFiles(
222
- getargs.input, getargs.verbose, fnamedict, False)
223
+ input_file, getargs.verbose, fnamedict, False)
223
224
  if(not tmpout):
224
225
  sys.exit(1)
225
226
  else:
226
227
  pycatfile.ArchiveFileListFiles(
227
- getargs.input, 0, 0, getargs.skipchecksum, fnamedict, getargs.verbose, False)
228
+ input_file, 0, 0, getargs.skipchecksum, fnamedict, getargs.verbose, False)
228
229
  elif active_action == 'validate':
229
230
  if getargs.convert:
230
231
  checkcompressfile = pycatfile.CheckCompressionSubType(
231
- getargs.input, fnamedict, True)
232
+ input_file, fnamedict, True)
232
233
  tempout = BytesIO()
233
234
  if(checkcompressfile == "catfile"):
234
- tmpout = pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.wholefile,
235
+ tmpout = pycatfile.RePackArchiveFile(input_file, tempout, getargs.compression, getargs.wholefile,
235
236
  getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamedict, False, False)
236
237
  else:
237
238
  tmpout = pycatfile.PackArchiveFileFromInFile(
238
- getargs.input, tempout, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, False, False)
239
- getargs.input = tempout
239
+ input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, getargs.checksum, [], fnamedict, False, False)
240
+ input_file = tempout
240
241
  if(not tmpout):
241
242
  sys.exit(1)
242
243
  fvalid = pycatfile.ArchiveFileValidate(
243
- getargs.input, fnamedict, getargs.verbose, False)
244
+ input_file, fnamedict, getargs.verbose, False)
244
245
  if(not getargs.verbose):
245
246
  import sys
246
247
  import logging
247
248
  logging.basicConfig(format="%(message)s",
248
249
  stream=sys.stdout, level=logging.DEBUG)
249
250
  if(fvalid):
250
- pycatfile.VerbosePrintOut("File is valid: \n" + str(getargs.input))
251
+ pycatfile.VerbosePrintOut("File is valid: \n" + str(input_file))
251
252
  else:
252
253
  pycatfile.VerbosePrintOut(
253
- "File is invalid: \n" + str(getargs.input))
254
+ "File is invalid: \n" + str(input_file))
@@ -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: neocatfile.py - Last Update: 12/20/2024 Ver. 0.15.12 RC 1 - Author: cooldude2k $
17
+ $FileInfo: neocatfile.py - Last Update: 12/21/2024 Ver. 0.15.14 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
@@ -55,7 +55,7 @@ argparser = argparse.ArgumentParser(
55
55
  description="Manipulates concatenated files for various operations like creation, extraction, and validation.")
56
56
  argparser.add_argument("-V", "--version", action="version", version="{0} {1}".format(
57
57
  __program_name__, __version__), help="Displays the program's version.")
58
- argparser.add_argument("-i", "--input", required=True,
58
+ argparser.add_argument("-i", "--input", nargs="+", required=True,
59
59
  help="Specifies input file(s) for processing.")
60
60
  argparser.add_argument(
61
61
  "-o", "--output", help="Specifies the output file name.")
@@ -94,43 +94,43 @@ elif args.list:
94
94
  primary_action = 'list'
95
95
  elif args.validate:
96
96
  primary_action = 'validate'
97
-
97
+ input_file = args.input[0]
98
98
  # Functionality mappings
99
99
  if primary_action == 'create':
100
100
  if args.convert == 'tar':
101
- pycatfile.PackArchiveFileFromTarFile(args.input, args.output, args.compression, args.level, args.checksum, [
101
+ pycatfile.PackArchiveFileFromTarFile(input_file, args.output, args.compression, args.level, args.checksum, [
102
102
  ], pycatfile.__file_format_list__, args.verbose, False)
103
103
  elif args.convert == 'zip':
104
- pycatfile.PackArchiveFileFromZipFile(args.input, args.output, args.compression, args.level, args.checksum, [
104
+ pycatfile.PackArchiveFileFromZipFile(input_file, args.output, args.compression, args.level, args.checksum, [
105
105
  ], pycatfile.__file_format_list__, args.verbose, False)
106
106
  elif py7zr_support and args.convert == '7zip':
107
- pycatfile.PackArchiveFileFromSevenZipFile(args.input, args.output, args.compression, args.level, args.checksum, [
107
+ pycatfile.PackArchiveFileFromSevenZipFile(input_file, args.output, args.compression, args.level, args.checksum, [
108
108
  ], pycatfile.__file_format_list__, args.verbose, False)
109
109
  elif rarfile_support and args.convert == 'rar':
110
- pycatfile.PackArchiveFileFromRarFile(args.input, args.output, args.compression, args.level, args.checksum, [
110
+ pycatfile.PackArchiveFileFromRarFile(input_file, args.output, args.compression, args.level, args.checksum, [
111
111
  ], pycatfile.__file_format_list__, args.verbose, False)
112
112
  else:
113
113
  pycatfile.PackArchiveFile(args.input, args.output, args.verbose, args.compression, args.level,
114
114
  False, args.checksum, [], pycatfile.__file_format_list__, args.verbose, False)
115
115
  elif primary_action == 'repack':
116
116
  pycatfile.RePackArchiveFile(
117
- args.input, args.output, args.compression, args.level, args.checksum, args.verbose)
117
+ input_file, args.output, args.compression, args.level, args.checksum, args.verbose)
118
118
  elif primary_action == 'extract':
119
119
  pycatfile.UnPackArchiveFile(
120
- args.input, args.output, args.verbose, args.preserve)
120
+ input_file, args.output, args.verbose, args.preserve)
121
121
  elif primary_action == 'list':
122
122
  if args.convert == 'tar':
123
- pycatfile.TarFileListFiles(args.input, verbose=args.verbose)
123
+ pycatfile.TarFileListFiles(input_file, verbose=args.verbose)
124
124
  elif args.convert == 'zip':
125
- pycatfile.ZipFileListFiles(args.input, verbose=args.verbose)
125
+ pycatfile.ZipFileListFiles(input_file, verbose=args.verbose)
126
126
  elif args.convert == '7zip':
127
- pycatfile.SevenZipFileListFiles(args.input, verbose=args.verbose)
127
+ pycatfile.SevenZipFileListFiles(input_file, verbose=args.verbose)
128
128
  elif rarfile_support and args.convert == 'rar':
129
- pycatfile.RarFileListFiles(args.input, verbose=args.verbose)
129
+ pycatfile.RarFileListFiles(input_file, verbose=args.verbose)
130
130
  else:
131
- pycatfile.ArchiveFileListFiles(args.input, verbose=args.verbose)
131
+ pycatfile.ArchiveFileListFiles(input_file, verbose=args.verbose)
132
132
  elif primary_action == 'validate':
133
- is_valid = pycatfile.ArchiveFileValidate(args.input, args.verbose)
133
+ is_valid = pycatfile.ArchiveFileValidate(input_file, args.verbose)
134
134
  result_msg = "Validation result for {0}: {1}".format(
135
- args.input, 'Valid' if is_valid else 'Invalid')
135
+ input_file, 'Valid' if is_valid else 'Invalid')
136
136
  print(result_msg)
@@ -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: pycatfile.py - Last Update: 12/20/2024 Ver. 0.15.12 RC 1 - Author: cooldude2k $
17
+ $FileInfo: pycatfile.py - Last Update: 12/21/2024 Ver. 0.15.14 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
@@ -304,12 +304,12 @@ __file_format_dict__ = {'format_name': __file_format_name__, 'format_magic': __f
304
304
  'format_delimiter': __file_format_delimiter__, 'format_ver': __file_format_ver__, 'new_style': __use_new_style__, 'use_advanced_list': __use_advanced_list__, 'use_alt_inode': __use_alt_inode__}
305
305
  __project__ = __program_name__
306
306
  __project_url__ = "https://github.com/GameMaker2k/PyCatFile"
307
- __version_info__ = (0, 15, 12, "RC 1", 1)
308
- __version_date_info__ = (2024, 12, 20, "RC 1", 1)
307
+ __version_info__ = (0, 15, 14, "RC 1", 1)
308
+ __version_date_info__ = (2024, 12, 21, "RC 1", 1)
309
309
  __version_date__ = str(__version_date_info__[0]) + "." + str(
310
310
  __version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
311
311
  __revision__ = __version_info__[3]
312
- __revision_id__ = "$Id: 1462baae55cec6c1aac531873eaeb2b3efe154d4 $"
312
+ __revision_id__ = "$Id: 5ac437d67d0b485df434560f6f73d2823777d4c1 $"
313
313
  if(__version_info__[4] is not None):
314
314
  __version_date_plusrc__ = __version_date__ + \
315
315
  "-" + str(__version_date_info__[4])
@@ -591,6 +591,8 @@ def ListDir(dirpath, followlink=False, duplicates=False, include_regex=None, exc
591
591
  Returns:
592
592
  list: A list of files and directories matching the criteria.
593
593
  """
594
+ if os.stat not in os.supports_follow_symlinks and followlink:
595
+ followlink = False
594
596
  if isinstance(dirpath, (list, tuple)):
595
597
  dirpath = list(filter(None, dirpath))
596
598
  elif isinstance(dirpath, basestring):
@@ -656,6 +658,8 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False, include_regex=N
656
658
  Returns:
657
659
  list: A list of files and directories matching the criteria.
658
660
  """
661
+ if os.stat not in os.supports_follow_symlinks and followlink:
662
+ followlink = False
659
663
  if isinstance(dirpath, (list, tuple)):
660
664
  dirpath = list(filter(None, dirpath))
661
665
  elif isinstance(dirpath, basestring):
@@ -729,7 +733,7 @@ def GetTotalSize(file_list):
729
733
  return total_size
730
734
 
731
735
 
732
- def create_alias_function(prefix, base_name, suffix, target_function):
736
+ def create_alias_function_alt(prefix, base_name, suffix, target_function):
733
737
  # Define a new function that wraps the target function
734
738
  def alias_function(*args, **kwargs):
735
739
  return target_function(*args, **kwargs)
@@ -739,7 +743,7 @@ def create_alias_function(prefix, base_name, suffix, target_function):
739
743
  globals()[function_name] = alias_function
740
744
 
741
745
 
742
- def create_alias_function_alt(prefix, base_name, suffix, target_function):
746
+ def create_alias_function(prefix, base_name, suffix, target_function):
743
747
  # Create the function name by combining the prefix, base name, and the suffix
744
748
  # Use the format method for string formatting, compatible with Python 2 and 3
745
749
  function_name = "{}{}{}".format(prefix, base_name, suffix)
@@ -2611,6 +2615,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
2611
2615
  infilelist = list(filter(None, infiles))
2612
2616
  elif(isinstance(infiles, (basestring, ))):
2613
2617
  infilelist = list(filter(None, [infiles]))
2618
+ if os.stat not in os.supports_follow_symlinks and followlink:
2619
+ followlink = False
2614
2620
  if(advancedlist):
2615
2621
  GetDirList = ListDirAdvanced(infilelist, followlink, False)
2616
2622
  else:
@@ -3796,6 +3802,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
3796
3802
  infilelist = list(filter(None, infiles))
3797
3803
  elif(isinstance(infiles, (basestring, ))):
3798
3804
  infilelist = list(filter(None, [infiles]))
3805
+ if os.stat not in os.supports_follow_symlinks and followlink:
3806
+ followlink = False
3799
3807
  if(advancedlist):
3800
3808
  GetDirList = ListDirAdvanced(infilelist, followlink, False)
3801
3809
  else:
@@ -6482,6 +6490,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
6482
6490
  infilelist = list(filter(None, infiles))
6483
6491
  elif(isinstance(infiles, (basestring, ))):
6484
6492
  infilelist = list(filter(None, [infiles]))
6493
+ if os.stat not in os.supports_follow_symlinks and followlink:
6494
+ followlink = False
6485
6495
  if(advancedlist):
6486
6496
  GetDirList = ListDirAdvanced(infilelist, followlink, False)
6487
6497
  else:
@@ -13,7 +13,7 @@
13
13
  Copyright 2016-2024 Game Maker 2k - http://intdb.sourceforge.net/
14
14
  Copyright 2016-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
15
15
 
16
- $FileInfo: setup.py - Last Update: 12/20/2024 Ver. 0.15.12 RC 1 - Author: cooldude2k $
16
+ $FileInfo: setup.py - Last Update: 12/21/2024 Ver. 0.15.14 RC 1 - Author: cooldude2k $
17
17
  '''
18
18
 
19
19
  import os
File without changes
File without changes
File without changes