Skip to content

Commit eddea09

Browse files
authored
Merge pull request #83 from PropGit/LinuxFix
Linux fix
2 parents eec3a9e + 02c380b commit eddea09

File tree

4 files changed

+58
-26
lines changed

4 files changed

+58
-26
lines changed

BlocklyPropClient.linux.spec

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
11
# -*- mode: python -*-
2-
a = Analysis(['BlocklyPropClient.py'],
32

3+
block_cipher = None
4+
5+
6+
a = Analysis(['BlocklyPropClient.py'],
7+
binaries=None,
8+
datas=None,
49
hiddenimports=[],
5-
hookspath=None,
6-
runtime_hooks=None)
7-
pyz = PYZ(a.pure)
10+
hookspath=[],
11+
runtime_hooks=[],
12+
excludes=[],
13+
win_no_prefer_redirects=False,
14+
win_private_assemblies=False,
15+
cipher=block_cipher)
16+
pyz = PYZ(a.pure, a.zipped_data,
17+
cipher=block_cipher)
818
exe = EXE(pyz,
919
a.scripts,
1020
exclude_binaries=True,
1121
name='BlocklyPropClient',
1222
debug=False,
13-
strip=None,
14-
upx=false,
15-
console=True,
16-
icon='blocklyprop.ico' )
23+
strip=False,
24+
upx=False,
25+
console=False , icon='BlocklyPropClient.ico')
26+
27+
#Propeller Tools
1728
propeller_libs_and_tools = Tree('propeller-tools', prefix='propeller-tools', excludes=['*.pdf', 'windows', 'mac'])
29+
propeller_libs_and_tools += [('about.txt', 'about.txt', 'About file')]
30+
31+
#Collection (edited to include Propeller Tools)
1832
coll = COLLECT(exe,
1933
a.binaries,
2034
a.zipfiles,
2135
a.datas,
2236
propeller_libs_and_tools,
23-
strip=None,
37+
strip=False,
2438
upx=False,
25-
name='BlocklyPropClient.linux')
39+
name='BlocklyPropClient')
2640

2741
# Analysis
28-
# pathex=['D:\\Development\\python\\BlocklyPropClient'],
42+
# pathex=['/home/developer/Projects/BlocklyPropClient'],
43+

BlocklyPropClient.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# NOTE:
3535
#
3636
# Please verify that the version number in the local about.txt and the
37-
# ./package/win0resources/blocklypropclient-installer.iss
37+
# ./package/win-resources/blocklypropclient-installer.iss matches this.
3838
# -----------------------------------------------------------------------
3939
VERSION = "0.5.4"
4040

@@ -64,10 +64,15 @@ def __init__(self, *args, **kwargs):
6464
self.app_version = "0.0"
6565
self.connected = False
6666

67-
# Path to where application was launched
68-
self.appdir = os.path.dirname(sys.argv[0])
69-
self.logger.info('Logging is enabled')
70-
self.logger.info('Application launched from %s', self.appdir)
67+
# Find the path from which application was launched
68+
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
69+
self.appdir = os.path.dirname(os.path.realpath(__file__))
70+
if self.appdir == "" or self.appdir == "/":
71+
# launch path is blank; try extracting from argv
72+
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))
73+
74+
self.logger.info('Logging is enabled')
75+
self.logger.info('BlocklyPropClient.py: Application launched from %s', self.appdir)
7176

7277
# initialize config variables
7378
self.ip_address = tk.StringVar()

BlocklyServer.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ def __init__(self, version, queue):
2727

2828
self.version = version
2929
self.queue = queue
30-
self.appdir = os.path.dirname(sys.argv[0])
31-
self.logger.debug("Application started from: %s", self.appdir)
30+
31+
# Find the path from which application was launched
32+
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
33+
self.appdir = os.path.dirname(os.path.realpath(__file__))
34+
if self.appdir == "" or self.appdir == "/":
35+
# launch path is blank; try extracting from argv
36+
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))
37+
38+
self.logger.debug("BlocklyServer.py: Application started from: %s", self.appdir)
3239

3340
queue.put((10, 'INFO', 'Server started'))
3441

PropellerLoad.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ def __init__(self):
1818
self.logger = logging.getLogger('blockly.loader')
1919
self.logger.info('Creating loader logger.')
2020

21-
# Find the path to the application launch directory
22-
self.appdir = os.path.dirname(sys.argv[0])
23-
self.logger.debug("Application running from: %s", self.appdir)
24-
25-
# if not self.appdir:
26-
# self.appdir = os.getcwd()
21+
# Find the path from which application was launched
22+
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
23+
self.appdir = os.path.dirname(os.path.realpath(__file__))
24+
if self.appdir == "" or self.appdir == "/":
25+
# launch path is blank; try extracting from argv
26+
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))
27+
self.logger.debug("PropellerLoad.py: Application running from: %s", self.appdir)
2728

2829
self.propeller_load_executables = {
2930
"Windows": "/propeller-tools/windows/propeller-load.exe",
@@ -71,8 +72,12 @@ def load(self, action, file_to_load, com_port):
7172
self.loading = True
7273

7374
# Patch until we figure out why the __init__ is not getting called
74-
if not self.appdir or self.appdir == '':
75-
self.appdir = os.path.dirname(sys.argv[0])
75+
if not self.appdir or self.appdir == '':
76+
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
77+
self.appdir = os.path.dirname(os.path.realpath(__file__))
78+
if self.appdir == "" or self.appdir == "/":
79+
# launch path is blank; try extracting from argv
80+
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))
7681

7782
executable = self.appdir + self.propeller_load_executables[platform.system()]
7883
self.logger.debug('Loader executable path is: %s)', executable)

0 commit comments

Comments
 (0)