@@ -1925,9 +1925,6 @@ def _parse_compose_file(self):
1925
1925
dotenv_path = os .path .realpath (args .env_file )
1926
1926
dotenv_dict .update (dotenv_to_dict (dotenv_path ))
1927
1927
1928
- # TODO: remove next line
1929
- os .chdir (dirname )
1930
-
1931
1928
os .environ .update ({
1932
1929
key : value for key , value in dotenv_dict .items () if key .startswith ("PODMAN_" )
1933
1930
})
@@ -1969,11 +1966,18 @@ def _parse_compose_file(self):
1969
1966
content = normalize (content )
1970
1967
# log(filename, json.dumps(content, indent = 2))
1971
1968
content = rec_subs (content , self .environ )
1969
+ if isinstance (services := content .get ('services' ), dict ):
1970
+ for service in services .values ():
1971
+ if 'extends' in service and (service_file := service ['extends' ].get ('file' )):
1972
+ service ['extends' ]['file' ] = os .path .join (
1973
+ os .path .dirname (filename ), service_file
1974
+ )
1975
+
1972
1976
rec_merge (compose , content )
1973
1977
# If `include` is used, append included files to files
1974
1978
include = compose .get ("include" )
1975
1979
if include :
1976
- files .extend (include )
1980
+ files .extend ([ os . path . join ( os . path . dirname ( filename ), i ) for i in include ] )
1977
1981
# As compose obj is updated and tested with every loop, not deleting `include`
1978
1982
# from it, results in it being tested again and again, original values for
1979
1983
# `include` be appended to `files`, and, included files be processed for ever.
0 commit comments