PyNeoFile 0.27.2__py3-none-any.whl → 0.27.6__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.
@@ -0,0 +1,237 @@
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: neofile.py - Last Update: 11/19/2025 Ver. 0.27.6 RC 1 - Author: cooldude2k $
18
+ '''
19
+
20
+ from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
21
+ import os
22
+ import sys
23
+ import logging
24
+ import argparse
25
+ import pyneofile
26
+ import binascii
27
+
28
+ # Text streams (as provided by Python)
29
+ PY_STDIN_TEXT = sys.stdin
30
+ PY_STDOUT_TEXT = sys.stdout
31
+ PY_STDERR_TEXT = sys.stderr
32
+
33
+ # Binary-friendly streams (use .buffer on Py3, fall back on Py2)
34
+ PY_STDIN_BUF = getattr(sys.stdin, "buffer", sys.stdin)
35
+ PY_STDOUT_BUF = getattr(sys.stdout, "buffer", sys.stdout)
36
+ PY_STDERR_BUF = getattr(sys.stderr, "buffer", sys.stderr)
37
+ logging.basicConfig(format="%(message)s", stream=PY_STDOUT_TEXT, level=logging.DEBUG)
38
+
39
+ # Conditional import and signal handling for Unix-like systems
40
+ if os.name != 'nt': # Not Windows
41
+ import signal
42
+ if hasattr(signal, 'SIGPIPE'):
43
+ def handler(signum, frame):
44
+ pyneofile.VerbosePrintOut(
45
+ "Received SIGPIPE, exiting gracefully.", "info")
46
+ sys.exit(0)
47
+ signal.signal(signal.SIGPIPE, handler)
48
+
49
+ rarfile_support = pyneofile.rarfile_support
50
+ py7zr_support = pyneofile.py7zr_support
51
+
52
+ if(sys.version[0] == "2"):
53
+ try:
54
+ from io import StringIO, BytesIO
55
+ except ImportError:
56
+ try:
57
+ from cStringIO import StringIO
58
+ from cStringIO import StringIO as BytesIO
59
+ except ImportError:
60
+ from StringIO import StringIO
61
+ from StringIO import StringIO as BytesIO
62
+ elif(sys.version[0] >= "3"):
63
+ from io import StringIO, BytesIO
64
+ else:
65
+ teststringio = 0
66
+ if(teststringio <= 0):
67
+ try:
68
+ from cStringIO import StringIO as BytesIO
69
+ teststringio = 1
70
+ except ImportError:
71
+ teststringio = 0
72
+ if(teststringio <= 0):
73
+ try:
74
+ from StringIO import StringIO as BytesIO
75
+ teststringio = 2
76
+ except ImportError:
77
+ teststringio = 0
78
+ if(teststringio <= 0):
79
+ try:
80
+ from io import BytesIO
81
+ teststringio = 3
82
+ except ImportError:
83
+ teststringio = 0
84
+
85
+ __project__ = pyneofile.__project__
86
+ __program_name__ = pyneofile.__program_name__
87
+ __file_format_name__ = pyneofile.__file_format_name__
88
+ __file_format_magic__ = pyneofile.__file_format_magic__
89
+ __file_format_len__ = pyneofile.__file_format_len__
90
+ __file_format_hex__ = pyneofile.__file_format_hex__
91
+ __file_format_delimiter__ = pyneofile.__file_format_delimiter__
92
+ __file_format_dict__ = pyneofile.__file_format_dict__
93
+ __file_format_default__ = pyneofile.__file_format_default__
94
+ __file_format_multi_dict__ = pyneofile.__file_format_multi_dict__
95
+ __use_new_style__ = pyneofile.__use_new_style__
96
+ __use_advanced_list__ = pyneofile.__use_advanced_list__
97
+ __use_alt_inode__ = pyneofile.__use_alt_inode__
98
+ __project_url__ = pyneofile.__project_url__
99
+ __version_info__ = pyneofile.__version_info__
100
+ __version_date_info__ = pyneofile.__version_date_info__
101
+ __version_date__ = pyneofile.__version_date__
102
+ __version_date_plusrc__ = pyneofile.__version_date_plusrc__
103
+ __version__ = pyneofile.__version__
104
+
105
+ # Initialize the argument parser
106
+ argparser = argparse.ArgumentParser(description="Manipulate archive files.", conflict_handler="resolve", add_help=True)
107
+
108
+ # Version information
109
+ argparser.add_argument("-V", "--version", action="version", version=__program_name__ + " " + __version__)
110
+ # Input and output specifications
111
+ argparser.add_argument("-i", "--input", nargs="+", help="Specify the file(s) to concatenate or the archive file to extract.", required=True)
112
+ argparser.add_argument("-o", "--output", default=None, help="Specify the name for the extracted or output archive files.")
113
+ # Operations
114
+ argparser.add_argument("-c", "--create", action="store_true", help="Perform only the concatenation operation.")
115
+ argparser.add_argument("-e", "--extract", action="store_true", help="Perform only the extraction operation.")
116
+ argparser.add_argument("-t", "--convert", action="store_true", help="Convert a tar/zip/rar/7zip file to a archive file.")
117
+ argparser.add_argument("-r", "--repack", action="store_true", help="Re-concatenate files, fixing checksum errors if any.")
118
+ argparser.add_argument("-S", "--filestart", type=int, default=0, help="Start reading file at.")
119
+ # File manipulation options
120
+ argparser.add_argument("-F", "--format", default="auto", help="Specify the format to use.")
121
+ argparser.add_argument("-D", "--delimiter", default=__file_format_dict__['format_delimiter'], help="Specify the delimiter to use.")
122
+ argparser.add_argument("-m", "--formatver", default=__file_format_dict__['format_ver'], help="Specify the format version.")
123
+ argparser.add_argument("-l", "--list", action="store_true", help="List files included in the archive file.")
124
+ # Compression options
125
+ argparser.add_argument("-P", "--compression", default="auto", help="Specify the compression method to use for concatenation.")
126
+ argparser.add_argument("-L", "--level", default=None, help="Specify the compression level for concatenation.")
127
+ argparser.add_argument("-W", "--wholefile", action="store_true", help="Whole file compression method to use for concatenation.")
128
+ # Checksum and validation
129
+ argparser.add_argument("-v", "--validate", action="store_true", help="Validate archive file checksums.")
130
+ argparser.add_argument("-C", "--checksum", default="md5", help="Specify the type of checksum to use. The default is md5.")
131
+ argparser.add_argument("-s", "--skipchecksum", action="store_true", help="Skip the checksum check of files.")
132
+ argparser.add_argument("-k", "--insecretkey", default=None, help="Secretkey to use for checksum input.")
133
+ argparser.add_argument("-K", "--outsecretkey", default=None, help="Secretkey to use for checksum output.")
134
+ # Permissions and metadata
135
+ argparser.add_argument("-p", "--preserve", action="store_false", help="Do not preserve permissions and timestamps of files.")
136
+ # Miscellaneous
137
+ argparser.add_argument("-d", "--verbose", action="store_true", help="Enable verbose mode to display various debugging information.")
138
+ argparser.add_argument("-T", "--text", action="store_true", help="Read file locations from a text file.")
139
+ # Parse the arguments
140
+ getargs = argparser.parse_args()
141
+
142
+ fname = getargs.format
143
+ if(getargs.format=="auto"):
144
+ fnamedict = __file_format_multi_dict__
145
+ __file_format_default__ = getargs.format
146
+ else:
147
+ fnamemagic = fname
148
+ fnamelen = len(fname)
149
+ fnamehex = binascii.hexlify(fname.encode("UTF-8")).decode("UTF-8")
150
+ __file_format_default__ = fnamemagic
151
+ fnamesty = __use_new_style__
152
+ fnamelst = __use_advanced_list__
153
+ fnameino = __use_alt_inode__
154
+ fnamedict = {'format_name': fname, 'format_magic': fnamemagic, 'format_len': fnamelen, 'format_hex': fnamehex,
155
+ 'format_delimiter': getargs.delimiter, 'format_ver': getargs.formatver, 'new_style': fnamesty, 'use_advanced_list': fnamelst, 'use_alt_inode': fnameino}
156
+
157
+ # Determine the primary action based on user input
158
+ actions = ['create', 'extract', 'list', 'repack', 'validate']
159
+ active_action = next(
160
+ (action for action in actions if getattr(getargs, action)), None)
161
+ input_file = getargs.input[0]
162
+
163
+ # Execute the appropriate functions based on determined actions and arguments
164
+ if active_action:
165
+ if active_action == 'create':
166
+ if getargs.convert:
167
+ checkcompressfile = pyneofile.CheckCompressionSubType(
168
+ input_file, fnamedict, 0, True)
169
+ if((pyneofile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyneofile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
170
+ tmpout = pyneofile.RePackNeoFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, False, 0, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, getargs.verbose, False)
171
+ else:
172
+ tmpout = pyneofile.PackNeoFileFromInFile(
173
+ input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
174
+ if(not tmpout):
175
+ sys.exit(1)
176
+ else:
177
+ pyneofile.PackNeoFile(getargs.input, getargs.output, getargs.text, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, False, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
178
+ elif active_action == 'repack':
179
+ if getargs.convert:
180
+ checkcompressfile = pyneofile.CheckCompressionSubType(
181
+ input_file, fnamedict, 0, True)
182
+ if((pyneofile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyneofile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
183
+ pyneofile.RePackNeoFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt,
184
+ False, 0, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, getargs.verbose, False)
185
+ else:
186
+ pyneofile.PackNeoFileFromInFile(input_file, getargs.output, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, getargs.verbose, False)
187
+ if(not tmpout):
188
+ sys.exit(1)
189
+ else:
190
+ pyneofile.RePackNeoFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt,
191
+ 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)
192
+ elif active_action == 'extract':
193
+ if getargs.convert:
194
+ checkcompressfile = pyneofile.CheckCompressionSubType(
195
+ input_file, fnamedict, 0, True)
196
+ tempout = BytesIO()
197
+ if((pyneofile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyneofile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
198
+ tmpout = pyneofile.RePackNeoFile(input_file, tempout, "auto", getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, False, 0, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, False)
199
+ else:
200
+ tmpout = pyneofile.PackNeoFileFromInFile(
201
+ input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, False, False)
202
+ if(not tmpout):
203
+ sys.exit(1)
204
+ input_file = tempout
205
+ pyneofile.UnPackNeoFile(input_file, getargs.output, False, getargs.filestart, 0, 0, getargs.skipchecksum,
206
+ fnamedict, getargs.verbose, getargs.preserve, getargs.preserve, False, False)
207
+ elif active_action == 'list':
208
+ if getargs.convert:
209
+ checkcompressfile = pyneofile.CheckCompressionSubType(
210
+ input_file, fnamedict, 0, True)
211
+ if((pyneofile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyneofile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
212
+ tmpout = pyneofile.NeoFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.insecretkey, False, getargs.verbose, False, False)
213
+ else:
214
+ tmpout = pyneofile.InFileListFiles(input_file, getargs.verbose, fnamedict, getargs.insecretkey, False, False, False)
215
+ if(not tmpout):
216
+ sys.exit(1)
217
+ else:
218
+ pyneofile.NeoFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.insecretkey, False, getargs.verbose, False, False)
219
+ elif active_action == 'validate':
220
+ if getargs.convert:
221
+ checkcompressfile = pyneofile.CheckCompressionSubType(
222
+ input_file, fnamedict, 0, True)
223
+ tempout = BytesIO()
224
+ if((pyneofile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyneofile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
225
+ tmpout = pyneofile.RePackNeoFile(input_file, tempout, "auto", getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, False, 0, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, False, False, False)
226
+ else:
227
+ tmpout = pyneofile.PackNeoFileFromInFile(
228
+ input_file, tempout, __file_format_default__, getargs.compression, getargs.wholefile, getargs.level, pyneofile.compressionlistalt, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], [], {}, fnamedict, getargs.outsecretkey, False, False)
229
+ input_file = tempout
230
+ if(not tmpout):
231
+ sys.exit(1)
232
+ fvalid = pyneofile.StackedNeoFileValidate(
233
+ input_file, "auto", getargs.filestart, fnamedict, getargs.insecretkey, False, getargs.verbose, False)
234
+ if(fvalid):
235
+ pyneofile.VerbosePrintOut("File is valid: \n" + str(input_file))
236
+ else:
237
+ pyneofile.VerbosePrintOut("File is invalid: \n" + str(input_file))
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyNeoFile
3
+ Version: 0.27.6
4
+ Summary: A tar like file format name NeoFile.
5
+ Home-page: https://github.com/GameMaker2k/PyNeoFile
6
+ Download-URL: https://github.com/GameMaker2k/PyNeoFile/archive/master.tar.gz
7
+ Author: Ouka Neko-chan
8
+ Author-email: Himari Kitsune-chan <kazuki.suzuki.fox@gmail.com>, Ouka Neko-chan <kazuki.suzuki.cat@gmail.com>, Tsukiumi Neko-kun <kazuki.suzuki.wa@gmail.com>, Kazuki Suzuki Neko-kun <kazuki.suzuki.sadeghi@gmail.com>, Game Maker 2k <gamemaker2k@gmail.com>
9
+ Maintainer: Himari Kitsune-chan
10
+ Maintainer-email: kazuki.suzuki.fox@gmail.com
11
+ License: BSD-3-Clause
12
+ Platform: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: author
16
+ Dynamic: download-url
17
+ Dynamic: home-page
18
+ Dynamic: license-file
19
+ Dynamic: maintainer
20
+ Dynamic: maintainer-email
21
+ Dynamic: platform
22
+
23
+ A tar like file format name NeoFile
24
+ ![](logo.png?raw=true)
@@ -0,0 +1,8 @@
1
+ pyneofile.py,sha256=i1heXBD9U-ZHETLzU6ZOt-EGn308rYwcWbAMPAMOao4,625760
2
+ pyneofile-0.27.6.data/scripts/neofile.py,sha256=58vYS5Pv7eUHdmvpcX-sBEsfPjlefFN0vpH23_aDvFs,15035
3
+ pyneofile-0.27.6.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
4
+ pyneofile-0.27.6.dist-info/METADATA,sha256=zpmhHlW-Qkq0WCaR3hf8udwUVPl0hHVCDAfnypLNWK0,897
5
+ pyneofile-0.27.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ pyneofile-0.27.6.dist-info/top_level.txt,sha256=_-bBDCun16INq_ibkGkMIpnjvoBZ3KbKcgR6meoPsb8,10
7
+ pyneofile-0.27.6.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
+ pyneofile-0.27.6.dist-info/RECORD,,
@@ -1,20 +1,21 @@
1
1
  BSD 3-Clause License
2
2
 
3
- Copyright (c) 2025, Game Maker 2k
3
+ Copyright (c) 2018, Game Maker 2k
4
+ All rights reserved.
4
5
 
5
6
  Redistribution and use in source and binary forms, with or without
6
7
  modification, are permitted provided that the following conditions are met:
7
8
 
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
10
11
 
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
14
15
 
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
18
19
 
19
20
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
21
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE