rpatool: pack as python module and executable

This commit is contained in:
OleSTEEP 2025-05-01 02:57:37 +03:00
parent d221c2ca67
commit 0a1b1e17ee
6 changed files with 19 additions and 5 deletions

0
rpatool/__init__.py Normal file
View file

6
rpatool/__main__.py Normal file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env python3
from rpatool import rpatool
if __name__ == '__main__':
rpatool.main()

View file

@ -1,11 +1,9 @@
#!/usr/bin/env python3
from __future__ import print_function
import sys
import os
import codecs
import pickle
import errno
import random
try:
@ -39,6 +37,7 @@ if sys.version_info[0] >= 3:
def _unpickle(data):
# Specify latin1 encoding to prevent raw byte values from causing an ASCII decode error.
return pickle.loads(data, encoding='latin1')
elif sys.version_info[0] == 2:
def _unicode(text):
if isinstance(text, unicode):
@ -162,7 +161,6 @@ class RenPyArchive:
if self.verbose:
print(message)
# List files in archive and current internal storage.
def list(self):
return list(self.indexes.keys()) + list(self.files.keys())
@ -304,7 +302,8 @@ class RenPyArchive:
# Reload the file in our internal database.
self.load(filename)
if __name__ == "__main__":
def main():
import argparse
parser = argparse.ArgumentParser(
@ -490,3 +489,6 @@ if __name__ == "__main__":
else:
print('No operation specified :(')
print('Use {} --help for usage details.'.format(sys.argv[0]))
if __name__ == "__main__":
main()