diff --git a/BlocklyPropClient.linux.spec b/BlocklyPropClient.linux.spec index 21b441c..5ab1044 100644 --- a/BlocklyPropClient.linux.spec +++ b/BlocklyPropClient.linux.spec @@ -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'], + diff --git a/BlocklyPropClient.py b/BlocklyPropClient.py index 3e1ea7e..f7c99fc 100644 --- a/BlocklyPropClient.py +++ b/BlocklyPropClient.py @@ -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" @@ -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() diff --git a/BlocklyServer.py b/BlocklyServer.py index 99fd158..2936daf 100644 --- a/BlocklyServer.py +++ b/BlocklyServer.py @@ -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')) diff --git a/PropellerLoad.py b/PropellerLoad.py index 40e57a5..09beba5 100644 --- a/PropellerLoad.py +++ b/PropellerLoad.py @@ -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", @@ -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)