Skip to content

Commit

Permalink
Merge pull request #83 from PropGit/LinuxFix
Browse files Browse the repository at this point in the history
Linux fix
  • Loading branch information
zfi authored Mar 16, 2017
2 parents eec3a9e + 02c380b commit eddea09
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 26 deletions.
37 changes: 26 additions & 11 deletions BlocklyPropClient.linux.spec
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
# -*- mode: python -*-
a = Analysis(['BlocklyPropClient.py'],

block_cipher = None


a = Analysis(['BlocklyPropClient.py'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='BlocklyPropClient',
debug=False,
strip=None,
upx=false,
console=True,
icon='blocklyprop.ico' )
strip=False,
upx=False,
console=False , icon='BlocklyPropClient.ico')

#Propeller Tools
propeller_libs_and_tools = Tree('propeller-tools', prefix='propeller-tools', excludes=['*.pdf', 'windows', 'mac'])
propeller_libs_and_tools += [('about.txt', 'about.txt', 'About file')]

#Collection (edited to include Propeller Tools)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
propeller_libs_and_tools,
strip=None,
strip=False,
upx=False,
name='BlocklyPropClient.linux')
name='BlocklyPropClient')

# Analysis
# pathex=['D:\\Development\\python\\BlocklyPropClient'],
# pathex=['/home/developer/Projects/BlocklyPropClient'],

15 changes: 10 additions & 5 deletions BlocklyPropClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# NOTE:
#
# Please verify that the version number in the local about.txt and the
# ./package/win0resources/blocklypropclient-installer.iss
# ./package/win-resources/blocklypropclient-installer.iss matches this.
# -----------------------------------------------------------------------
VERSION = "0.5.4"

Expand Down Expand Up @@ -64,10 +64,15 @@ def __init__(self, *args, **kwargs):
self.app_version = "0.0"
self.connected = False

# Path to where application was launched
self.appdir = os.path.dirname(sys.argv[0])
self.logger.info('Logging is enabled')
self.logger.info('Application launched from %s', self.appdir)
# Find the path from which application was launched
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
self.appdir = os.path.dirname(os.path.realpath(__file__))
if self.appdir == "" or self.appdir == "/":
# launch path is blank; try extracting from argv
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))

self.logger.info('Logging is enabled')
self.logger.info('BlocklyPropClient.py: Application launched from %s', self.appdir)

# initialize config variables
self.ip_address = tk.StringVar()
Expand Down
11 changes: 9 additions & 2 deletions BlocklyServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ def __init__(self, version, queue):

self.version = version
self.queue = queue
self.appdir = os.path.dirname(sys.argv[0])
self.logger.debug("Application started from: %s", self.appdir)

# Find the path from which application was launched
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
self.appdir = os.path.dirname(os.path.realpath(__file__))
if self.appdir == "" or self.appdir == "/":
# launch path is blank; try extracting from argv
self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))

self.logger.debug("BlocklyServer.py: Application started from: %s", self.appdir)

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

Expand Down
21 changes: 13 additions & 8 deletions PropellerLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ def __init__(self):
self.logger = logging.getLogger('blockly.loader')
self.logger.info('Creating loader logger.')

# Find the path to the application launch directory
self.appdir = os.path.dirname(sys.argv[0])
self.logger.debug("Application running from: %s", self.appdir)

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

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

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

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

0 comments on commit eddea09

Please sign in to comment.