From d8ba6e34ea43a6021cf44353eec979ef1846f8ec Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 15 Apr 2014 19:04:43 -0700 Subject: [PATCH] Don't crash if 'HOME' is unset in env. Bump version to 1.3.5. Fixes . --- setup.py | 9 ++++----- src/__init__.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index c7dea28..a19458e 100644 --- a/setup.py +++ b/setup.py @@ -13,11 +13,10 @@ p = Popen(["make", "-C", make_dir]) os.waitpid(p.pid, 0) -# something better than this? -if os.getenv("USER") == "root": - config_dir = "/etc/phpsh" -else: - config_dir = os.getenv("HOME") + "/.phpsh" + +config_dir = os.path.expanduser('~/.phpsh') +if config_dir == '~/.phpsh' or os.getuid() == 0: + config_dir = '/etc/phpsh' setup( name="phpsh", diff --git a/src/__init__.py b/src/__init__.py index a32a861..24fd3fa 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,5 +1,5 @@ -__version__ = "1.3.4" -__date__ = "Feb 13, 2014" +__version__ = "1.3.5" +__date__ = "April 15, 2014" from subprocess import Popen, PIPE, call from threading import Thread