diff options
author | Gui Chen <gui.chen@intel.com> | 2013-02-04 10:51:35 +0800 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2013-02-05 20:51:28 +0800 |
commit | 20c7ac1ab8a3e777a26efa4916af393a4631e50e (patch) | |
tree | 2a7263c6509cd24d842184489b01a12f98e7f870 | |
parent | d6aef70247336b13f489600f5f46ca7878f970b7 (diff) | |
download | mic-20c7ac1ab8a3e777a26efa4916af393a4631e50e.tar.gz mic-20c7ac1ab8a3e777a26efa4916af393a4631e50e.tar.bz2 mic-20c7ac1ab8a3e777a26efa4916af393a4631e50e.zip |
fix no key 'HOME' in environ variable failure
Signed-off-by: Gui Chen <gui.chen@intel.com>
-rwxr-xr-x | plugins/backend/zypppkgmgr.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/backend/zypppkgmgr.py b/plugins/backend/zypppkgmgr.py index 41ce2ec..0d02ad8 100755 --- a/plugins/backend/zypppkgmgr.py +++ b/plugins/backend/zypppkgmgr.py @@ -400,13 +400,20 @@ class Zypp(BackendPlugin): # the default one is $HOME/.zypp, which cause conflicts when # installing some basic packages, and the location doesn't # have any interface actually, so use a tricky way anyway - homedir = os.environ['HOME'] - os.environ['HOME'] = '/' + homedir = None + if 'HOME' in os.environ: + homedir = os.environ['HOME'] + os.environ['HOME'] = '/' + else: + os.environ['HOME'] = '/' self.repo_manager.addRepository(repo_info) # save back the $HOME env - os.environ['HOME'] = homedir + if homedir: + os.environ['HOME'] = homedir + else: + del os.environ['HOME'] self.__build_repo_cache(name) |