Skip to content

Commit

Permalink
Production enable PLY for build
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexeh committed Sep 28, 2020
1 parent c68aac5 commit 3ad0e05
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19 deletions.
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@
if sys.platform == "win32":
base = "Win32GUI"

files = {"include_files": [

build_options = {
"include_files": [
"./images",
"./templates",
"./config.cfg",
"./readme.md",
],
}
"excludes": [
"tkinter",
"test",
"http",
"email",
"distutils"
],
"optimize": 2,
}

setup(
name='Joystick Diagrams',
Expand All @@ -38,6 +49,6 @@
'Source': 'https://github.com/Rexeh/joystick-diagrams/src',
},

options={'build_exe': files},
options={'build_exe': build_options},
executables = [Executable("./src/joystick_diagrams.py", base = base, icon = './images/logo.ico')]
)
8 changes: 5 additions & 3 deletions src/adaptors/dcs_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import ply.yacc as yacc
import functions.helper as helper
import adaptors.joystick_diagram_interface as jdi
import adaptors.dcs_world_lex # Do not remove - PLY production requirement
import adaptors.dcs_world_parse # Do not remove - PLY production requirement

class DCSWorld_Parser(jdi.JDinterface):

Expand Down Expand Up @@ -203,21 +205,21 @@ def p_error(t):
## TODO: Consider env vars to run optimize=1 in deployed version
lexer = lex.lex(
debug=False,
optimize=0,
optimize=1,
lextab='dcs_world_lex',
reflags=re.UNICODE | re.VERBOSE
)

# Build the parser
parser = yacc.yacc(
debug=False,
optimize=1,
tabmodule='dcs_world_parse'
)

# Parse the data
try:
data = parser.parse(self.file)
except Exception as error:
print(data)

print(error)
return data
10 changes: 10 additions & 0 deletions src/adaptors/dcs_world_lex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# dcs_world_lex.py. This file automatically created by PLY (version 3.11). Don't edit!
_tabversion = '3.10'
_lextokens = set(('COMMA', 'DOUBLE_VAL', 'EQUALS', 'FALSE', 'LBRACE', 'LCURLY', 'NUMBER', 'RBRACE', 'RCURLY', 'STRING', 'TRUE'))
_lexreflags = 96
_lexliterals = ''
_lexstateinfo = {'INITIAL': 'inclusive'}
_lexstatere = {'INITIAL': [('(?P<t_DOUBLE_VAL>(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P<t_NUMBER>[0-9]+)|(?P<t_STRING>\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\s]+\\")|(?P<t_TRUE>(true))|(?P<t_FALSE>(false))|(?P<t_LCURLY>\\{)|(?P<t_RCURLY>\\})|(?P<t_LBRACE>\\[)|(?P<t_RBRACE>\\])|(?P<t_COMMA>\\,)|(?P<t_EQUALS>\\=)', [None, ('t_DOUBLE_VAL', 'DOUBLE_VAL'), None, ('t_NUMBER', 'NUMBER'), ('t_STRING', 'STRING'), ('t_TRUE', 'TRUE'), None, ('t_FALSE', 'FALSE'), None, (None, 'LCURLY'), (None, 'RCURLY'), (None, 'LBRACE'), (None, 'RBRACE'), (None, 'COMMA'), (None, 'EQUALS')])]}
_lexstateignore = {'INITIAL': ' \t\n'}
_lexstateerrorf = {'INITIAL': 't_error'}
_lexstateeoff = {}
26 changes: 13 additions & 13 deletions src/adaptors/dcs_world_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
del _lr_goto_items
_lr_productions = [
("S' -> dict","S'",1,None,None,None),
('dict -> LCURLY dvalues RCURLY','dict',3,'p_dict','dcs_world.py',171),
('dvalues -> dvalue','dvalues',1,'p_dvalues','dcs_world.py',175),
('dvalues -> dvalue COMMA','dvalues',2,'p_dvalues','dcs_world.py',176),
('dvalues -> dvalue COMMA dvalues','dvalues',3,'p_dvalues','dcs_world.py',177),
('key -> LBRACE NUMBER RBRACE','key',3,'p_key_expression','dcs_world.py',183),
('key -> LBRACE STRING RBRACE','key',3,'p_key_expression','dcs_world.py',184),
('dvalue -> key EQUALS STRING','dvalue',3,'p_value_expression','dcs_world.py',188),
('dvalue -> key EQUALS boolean','dvalue',3,'p_value_expression','dcs_world.py',189),
('dvalue -> key EQUALS DOUBLE_VAL','dvalue',3,'p_value_expression','dcs_world.py',190),
('dvalue -> key EQUALS NUMBER','dvalue',3,'p_value_expression','dcs_world.py',191),
('dvalue -> key EQUALS dict','dvalue',3,'p_value_expression','dcs_world.py',192),
('boolean -> TRUE','boolean',1,'p_boolean','dcs_world.py',196),
('boolean -> FALSE','boolean',1,'p_boolean','dcs_world.py',197),
('dict -> LCURLY dvalues RCURLY','dict',3,'p_dict','dcs_world.py',170),
('dvalues -> dvalue','dvalues',1,'p_dvalues','dcs_world.py',174),
('dvalues -> dvalue COMMA','dvalues',2,'p_dvalues','dcs_world.py',175),
('dvalues -> dvalue COMMA dvalues','dvalues',3,'p_dvalues','dcs_world.py',176),
('key -> LBRACE NUMBER RBRACE','key',3,'p_key_expression','dcs_world.py',182),
('key -> LBRACE STRING RBRACE','key',3,'p_key_expression','dcs_world.py',183),
('dvalue -> key EQUALS STRING','dvalue',3,'p_value_expression','dcs_world.py',187),
('dvalue -> key EQUALS boolean','dvalue',3,'p_value_expression','dcs_world.py',188),
('dvalue -> key EQUALS DOUBLE_VAL','dvalue',3,'p_value_expression','dcs_world.py',189),
('dvalue -> key EQUALS NUMBER','dvalue',3,'p_value_expression','dcs_world.py',190),
('dvalue -> key EQUALS dict','dvalue',3,'p_value_expression','dcs_world.py',191),
('boolean -> TRUE','boolean',1,'p_boolean','dcs_world.py',195),
('boolean -> FALSE','boolean',1,'p_boolean','dcs_world.py',196),
]

0 comments on commit 3ad0e05

Please sign in to comment.