Skip to content

Commit b163976

Browse files
authored
Merge pull request #188 from jhmpub/lgtv-pyinstaller
pyinstaller changes
2 parents 8e1d9e8 + 2f0c892 commit b163976

7 files changed

Lines changed: 28 additions & 8 deletions

File tree

LGTV/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from __future__ import print_function
32
from inspect import getfullargspec
43

@@ -8,10 +7,15 @@
87
from time import sleep
98
import logging
109
import argparse
11-
from .scan import LGTVScan
12-
from .remote import LGTVRemote
13-
from .auth import LGTVAuth
14-
from .cursor import LGTVCursor
10+
11+
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
12+
if PACKAGE_PATH not in sys.path:
13+
sys.path.append(PACKAGE_PATH)
14+
15+
from scan import LGTVScan
16+
from remote import LGTVRemote
17+
from auth import LGTVAuth
18+
from cursor import LGTVCursor
1519

1620

1721
config_paths = [
@@ -21,6 +25,7 @@
2125
"/opt/venvs/lgtv/config/config.json"
2226
]
2327

28+
2429
def get_commands():
2530
text = 'commands\n'
2631
commands = LGTVRemote.getCommands()
@@ -192,3 +197,5 @@ def main():
192197

193198
if __name__ == '__main__':
194199
main()
200+
201+

LGTV/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from __init__ import main
2+
if __name__ == "__main__":
3+
main()
4+

LGTV/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
import json
77

8-
from .payload import hello_data
8+
from payload import hello_data
99

1010

1111
class LGTVAuth(WebSocketClient):

LGTV/cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import inspect
44
from time import sleep
55

6-
from .remote import LGTVRemote
6+
from remote import LGTVRemote
77
from ws4py.client.threadedclient import WebSocketClient
88

99

LGTV/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import logging
1111

12-
from .payload import hello_data
12+
from payload import hello_data
1313

1414

1515
class LGTVRemote(WebSocketClient):

build.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rem builds console and gui executables stored in the ./dist directory
2+
rem run "python -m pip install pyinstaller" to get pyinstaller
3+
4+
pyinstaller --clean --onefile --noconfirm --paths=.\LGTV --noconsole --name lgtv_gui lgtv.py
5+
pyinstaller --clean --onefile --noconfirm --paths=.\LGTV lgtv.py

lgtv.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from LGTV import main
2+
if __name__ == "__main__":
3+
main()
4+

0 commit comments

Comments
 (0)