Improved project for compiling

This commit is contained in:
Sven Heidemann 2022-01-19 16:31:31 +01:00
parent 00484711ab
commit fa5157298c
3 changed files with 35 additions and 8 deletions

16
scripts/compile.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
cd src
pyinstaller --specpath ../dist/cspec \
--workpath ../dist/cbuild \
--distpath ../dist/cdist \
--add-data ../../src/py_to_uxf/appsettings.json:. \
--hidden-import pynput.keyboard._xorg \
--hidden-import pynput.mouse._xorg \
--hidden-import pyfiglet.fonts \
--collect-data pyfiglet \
-n py_to_uxf \
-y \
py_to_uxf/main.py
cd ../

5
scripts/run.sh Normal file
View File

@ -0,0 +1,5 @@
cd dist/cdist/py_to_uxf
time ./py_to_uxf -p ../../../../sh_gismo/src -o gismo.uxf
cd ../../../

View File

@ -47,15 +47,21 @@ class Application(ApplicationABC):
Console.write_line(f'\t{func.access_modifier.value}{func.name}({args}): {func.return_type}')
Console.write_line()
@staticmethod
def _exit(msg: str, tb=None):
if tb is not None:
Console.error(msg, tb)
else:
Console.error(msg)
sys.exit()
def main(self):
Console.banner('Py to UXF')
if self._path is None:
Console.error('Expected path')
return
self._exit('Expected path\n')
if self._file is None:
Console.error(f'Expected output file')
return
self._exit(f'Expected output file\n')
Console.write_line(f'Input path:', self._path)
Console.write_line(f'Output path:', self._file)
@ -68,13 +74,13 @@ class Application(ApplicationABC):
# self._console_output(classes)
xml = self._umlet_creator.generate_xml(classes, implementations)
except Exception as e:
Console.error('Parsing failed', f'{e} -> {traceback.format_exc()}')
sys.exit()
self._exit('Parsing failed', f'{e} -> {traceback.format_exc()}\n')
if not self._file.endswith('.uxf'):
Console.error(f'Unexpected file {self._file}')
sys.exit()
self._exit(f'Unexpected file {self._file}\n')
with open(self._file, 'w+') as file:
file.write(xml)
file.close()
Console.write_line('\n')