@@ -561,16 +561,22 @@ def get_full_import_path(self, imp):
561
561
"""
562
562
563
563
core_imp = os .path .join (self .core_source , imp )
564
- if os .path .exists (core_imp ):
564
+ if os .path .exists (core_imp ) or os .path .exists (
565
+ os .path .dirname (core_imp )
566
+ ):
565
567
return core_imp
566
568
567
569
# Reinstate when using Jules Shared from Jules
568
570
# jules_imp = os.path.join(self.jules_source, imp)
569
- # if os.path.exists(jules_imp):
571
+ # if os.path.exists(jules_imp) or os.path.exists(
572
+ # os.path.dirname(jules_imp)
573
+ # ):
570
574
# return jules_imp
571
575
572
576
apps_imp = os .path .join (self .root_path , imp )
573
- if os .path .exists (apps_imp ):
577
+ if os .path .exists (apps_imp ) or os .path .exists (
578
+ os .path .dirname (apps_imp )
579
+ ):
574
580
return apps_imp
575
581
576
582
raise Exception (
@@ -609,7 +615,7 @@ def read_meta_imports(self, meta_dir, flag="import"):
609
615
# Split the import line by '=' then take the rhs
610
616
# Then remove the trailing '/HEAD'
611
617
# Then prepend the path to the working copy
612
- imp = line .split ("=" , 1 )[1 ].strip ("/HEAD" )
618
+ imp = line .split ("=" , 1 )[1 ].removesuffix ("/HEAD" )
613
619
imp = self .get_full_import_path (imp )
614
620
imports .append (imp )
615
621
else :
@@ -736,7 +742,7 @@ def write_new_macro(self, meta_dir, full_command):
736
742
" return config, self.reports\n "
737
743
)
738
744
739
- run_black (filepath )
745
+ run_black (temppath )
740
746
741
747
os .rename (temppath , filepath )
742
748
@@ -795,17 +801,7 @@ def preprocess_macros(self):
795
801
796
802
# Now reconstruct the macro for all applications which have the newly
797
803
# added macro or import metadata with the new macro
798
- # Note, this is only done for applications, not for science sections
799
804
for meta_dir in self .meta_dirs :
800
- if not (
801
- meta_dir .startswith (
802
- os .path .join (self .root_path , "applications" )
803
- )
804
- or meta_dir .startswith (
805
- os .path .join (self .core_source , "applications" )
806
- )
807
- ):
808
- continue
809
805
import_order = self .determine_import_order (meta_dir )
810
806
full_command = self .combine_macros (import_order )
811
807
# If there are commands to write out, do so and record this
0 commit comments