Something weird going on

Sun, 21 Jan 2018 12:04:24 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 21 Jan 2018 12:04:24 +0000
changeset 29
9dd2e5d57a7c
parent 28
a7c56424e867
child 30
3dd525652dc8

Something weird going on

instance.py file | annotate | diff | comparison | revisions
--- a/instance.py	Sun Jan 21 11:59:53 2018 +0000
+++ b/instance.py	Sun Jan 21 12:04:24 2018 +0000
@@ -41,20 +41,19 @@
 
         logging.info('Launching ' + str(cmd))
 
-        env=None
+        env=os.environ.copy()
         if passphrase:
-            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']
+        if '_PY2APP_LAUNCHED_' in env:
+            val=env['_PY2APP_LAUNCHED_']
+            if val=='1':
+                del env['PYTHONPATH']
+                del env['PYTHONHOME']
 
         self.proc=Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, stdin=PIPE)
 

mercurial