Browse Source

Reduce path manipulation

If we're using self.filename, then it's already a full path and we
don't need to splice off the filename.yml just so we can .join it
back together again.

Signed-off-by: Mazz Mosley <[email protected]>
Mazz Mosley 10 years ago
parent
commit
5e2d43843c
1 changed files with 4 additions and 4 deletions
  1. 4 4
      compose/config.py

+ 4 - 4
compose/config.py

@@ -163,12 +163,12 @@ class ServiceLoader(object):
         if self.working_dir is None:
             raise Exception("No working_dir passed to ServiceLoader()")
 
-        try:
+        if 'file' in extends_options:
             extends_from_filename = extends_options['file']
-        except KeyError:
-            extends_from_filename = os.path.split(self.filename)[1]
+            other_config_path = expand_path(self.working_dir, extends_from_filename)
+        else:
+            other_config_path = self.filename
 
-        other_config_path = expand_path(self.working_dir, extends_from_filename)
         other_working_dir = os.path.dirname(other_config_path)
         other_already_seen = self.already_seen + [self.signature(service_dict['name'])]
         other_loader = ServiceLoader(