# HG changeset patch # User Tuomo Valkonen # Date 1516499590 0 # Node ID 94d58d514d690879ed3ad887d7469fde8790f89f # Parent 86b42610d5a8ce8adcf8f5c3274f81f78a02d5b8 Workaround to PYTHONPATH and PYTHONHOME being messed up by py2app. diff -r 86b42610d5a8 -r 94d58d514d69 instance.py --- a/instance.py Sun Jan 21 01:15:01 2018 +0000 +++ b/instance.py Sun Jan 21 01:53:10 2018 +0000 @@ -46,6 +46,16 @@ env=os.environ.copy() env['BORG_PASSPHRASE']=passphrase + # Workaround: if launched is a standalone app created with py2app, + # borg will fail unless Python environment is reset. + # TODO: Of course, this will fail if the system needs the variables + # PYTHONPATH or PYTHONHOME set to certain values. + if '_PY2APP_LAUNCHED_' in env and env['_PY2APP_LAUNCHED_']=='1': + if env==None: + env=os.environ.copy() + del env['PYTHONPATH'] + del env['PYTHONHOME'] + self.proc=Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, stdin=PIPE) # We don't do passphrase input etc. diff -r 86b42610d5a8 -r 94d58d514d69 setup.py --- a/setup.py Sun Jan 21 01:15:01 2018 +0000 +++ b/setup.py Sun Jan 21 01:53:10 2018 +0000 @@ -3,7 +3,7 @@ APP = ['borgend.py'] DATA_FILES = [] OPTIONS = { - 'argv_emulation': True, + 'argv_emulation': False, 'plist': { 'LSUIElement': True, },