changeset 4:bdfc8a4a335d draft

Expose more information to the command formatting.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 06 Apr 2015 20:03:11 -0700
parents 455043eb436a
children 9c6605b1619b
files september.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/september.py	Sat Mar 28 15:51:21 2015 -0700
+++ b/september.py	Mon Apr 06 20:03:11 2015 -0700
@@ -139,6 +139,7 @@
     # Parse arguments.
     res = parser.parse_args()
     repo_dir = res.repo or os.getcwd()
+    work_dir = os.getcwd()
 
     # Guess the repo type.
     repo_type = res.scm
@@ -153,11 +154,13 @@
             sys.exit(1)
 
     # Find the configuration file.
+    config_file_dir = None
     config_file = res.config or os.path.join(repo_dir, '.september.cfg')
     config = configparser.ConfigParser(interpolation=None)
     if os.path.exists(config_file):
         logger.info("Loading configuration file: %s" % config_file)
         config.read(config_file)
+        config_file_dir = os.path.dirname(config_file)
 
     # Validate the configuration.
     if not config.has_section('september'):
@@ -259,6 +262,8 @@
         command = config_sec['command'] % {
                 'rev_id': ti['id'],
                 'root_dir': clone_dir,
+                'config_dir': config_file_dir,
+                'work_dir': work_dir,
                 'tag': tn}
         logger.info("Running: %s" % command)
         subprocess.check_call(command, shell=use_shell)