changeset 5:9c6605b1619b draft default tip

Make directories absolute and expand tilde-paths.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 12 May 2015 23:55:27 -0700
parents bdfc8a4a335d
children
files september.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/september.py	Mon Apr 06 20:03:11 2015 -0700
+++ b/september.py	Tue May 12 23:55:27 2015 -0700
@@ -139,6 +139,7 @@
     # Parse arguments.
     res = parser.parse_args()
     repo_dir = res.repo or os.getcwd()
+    repo_dir = os.path.abspath(repo_dir)
     work_dir = os.getcwd()
 
     # Guess the repo type.
@@ -156,6 +157,7 @@
     # Find the configuration file.
     config_file_dir = None
     config_file = res.config or os.path.join(repo_dir, '.september.cfg')
+    config_file = os.path.abspath(config_file)
     config = configparser.ConfigParser(interpolation=None)
     if os.path.exists(config_file):
         logger.info("Loading configuration file: %s" % config_file)
@@ -183,6 +185,8 @@
         tmp_name = 'september_%s' % hashlib.md5(
                 repo_dir.encode('utf8')).hexdigest()
         tmp_dir = os.path.join(tempfile.gettempdir(), tmp_name)
+    elif tmp_dir.startswith('~'):
+        tmp_dir = os.path.expanduser(tmp_dir)
 
     # Find the cache file in the temp directory.
     cache_file = os.path.join(tmp_dir, 'september.json')