Archived
1
0
Fork 0

[v0.1.0] remove pywin32 as dependencies

- use logger to print info
- print gecko code through stdout
This commit is contained in:
sup39 2023-02-11 23:27:07 +09:00
parent 0c722361e2
commit d04fe83498
2 changed files with 21 additions and 16 deletions

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = supSMSASM name = supSMSASM
version = 0.0.9 version = 0.1.0
author = sup39 author = sup39
author_email = sms@sup39.dev author_email = sms@sup39.dev
description = A tool to make Gecko code from ASM for SMS description = A tool to make Gecko code from ASM for SMS
@ -13,14 +13,14 @@ project_urls =
classifiers = classifiers =
Programming Language :: Python :: 3 Programming Language :: Python :: 3
License :: OSI Approved :: MIT License License :: OSI Approved :: MIT License
Operating System :: Microsoft :: Windows # Operating System :: Microsoft :: Windows
[options] [options]
include_package_data = True include_package_data = True
packages = find: packages = find:
python_requires = >=3.8 python_requires = >=3.8
install_requires = #install_requires =
pywin32 >= 304 # pywin32 >= 304
[options.packages.find] [options.packages.find]
where = src where = src

View file

@ -11,14 +11,18 @@ import re
from collections import defaultdict, Counter from collections import defaultdict, Counter
import logging import logging
import win32clipboard
def pbcopy(content): def pbcopy(content):
win32clipboard.OpenClipboard() print(content) #, file=sys.stderr)
win32clipboard.EmptyClipboard() #import win32clipboard
win32clipboard.SetClipboardText(content) #def pbcopy(content):
win32clipboard.CloseClipboard() # win32clipboard.OpenClipboard()
# win32clipboard.EmptyClipboard()
# win32clipboard.SetClipboardText(content)
# win32clipboard.CloseClipboard()
logger = logging.getLogger('supSMSASM') logger = logging.getLogger('supSMSASM')
loggerLevel = os.environ.get('LOG_LEVEL') or logging.INFO
logger.setLevel(loggerLevel)
def normalize_dolver(s): def normalize_dolver(s):
if re.match(r'^(?:JP?|N(?:TSC)?[-_]?J)(?:1\.?0|\.0)?$|^1\.0$|^GMSJ01$', s): if re.match(r'^(?:JP?|N(?:TSC)?[-_]?J)(?:1\.?0|\.0)?$|^1\.0$|^GMSJ01$', s):
@ -109,9 +113,10 @@ def asm2gecko(fnIn, dolver):
if m is None: continue if m is None: continue
ct, name = m.groups() ct, name = m.groups()
if name in geckoSymbs: if name in geckoSymbs:
logger.error('Conflict symbols: $%s$, $%s$ for `%s`'%( logger.error(
'Conflict symbols: $%s$, $%s$ for `%s`',
geckoSymbs[name][0], ct, name, geckoSymbs[name][0], ct, name,
)) )
return cleanup() return cleanup()
geckoSymbs[name] = (ct, addr) geckoSymbs[name] = (ct, addr)
@ -228,14 +233,14 @@ def main():
# print asm symbols # print asm symbols
if not isC2: if not isC2:
for name, addr in asmSymbs.items(): for name, addr in asmSymbs.items():
print(addr.upper(), name) logger.info('%s %s', addr.upper(), name)
print() #logger.info()
# print gecko symbols # print gecko symbols
for name, ct, src, dst in codeSymbs: for name, ct, src, dst in codeSymbs:
print('%-2s [%08X] @[%08X] %s'%(ct, dst, src, name)) logger.info('%-2s [%08X] @[%08X] %s', ct, dst, src, name)
print() #logger.info()
# code length # code length
print('Code length:', len(codes), 'line(s)') logger.info('Code length: %d line(s)', len(codes))
if __name__ == '__main__': if __name__ == '__main__':
main() main()