diff --git a/packages/oasis3-mct/package.py b/packages/oasis3-mct/package.py index f5117a9..a2aa42f 100644 --- a/packages/oasis3-mct/package.py +++ b/packages/oasis3-mct/package.py @@ -49,116 +49,127 @@ class Oasis3Mct(MakefilePackage): # use both the psmile and mct libraries $ARCHDIR/lib/libpsmile.MPI1.a # and libmct.a and libmpeu.a when linking. - __libs["mct"]["incfiles"] = [ "m_accumulatorcomms.mod", - "m_accumulator.mod", - "m_attrvectcomms.mod", - "m_attrvect.mod", - "m_attrvectreduce.mod", - "m_chars.mod", - "m_convertmaps.mod", - "mct_mod.mod", - "m_die.mod", - "m_dropdead.mod", - "m_errorhandler.mod", - "m_exchangemaps.mod", - "m_fccomms.mod", - "m_filename.mod", - "m_fileresolv.mod", - "m_flow.mod", - "m_generalgridcomms.mod", - "m_generalgrid.mod", - "m_globalmap.mod", - "m_globalsegmapcomms.mod", - "m_globalsegmap.mod", - "m_globaltolocal.mod", - "m_indexbin_char.mod", - "m_indexbin_integer.mod", - "m_indexbin_logical.mod", - "m_inpak90.mod", - "m_ioutil.mod", - "m_list.mod", - "m_mall.mod", - "m_matattrvectmul.mod", - "m_mctworld.mod", - "m_merge.mod", - "m_mergesorts.mod", - "m_mpif90.mod", - "m_mpif.mod", - "m_mpout.mod", - "m_navigator.mod", - "m_permuter.mod", - "m_rankmerge.mod", - "m_realkinds.mod", - "m_rearranger.mod", - "m_router.mod", - "m_sortingtools.mod", - "m_sparsematrixcomms.mod", - "m_sparsematrixdecomp.mod", - "m_sparsematrix.mod", - "m_sparsematrixplus.mod", - "m_sparsematrixtomaps.mod", - "m_spatialintegral.mod", - "m_spatialintegralv.mod", - "m_stdio.mod", - "m_string.mod", - "m_strtemplate.mod", - "m_traceback.mod", - "m_transfer.mod", - "m_zeit.mod" ] + __libs["mct"]["incfiles"] = [ + "m_accumulatorcomms.mod", + "m_accumulator.mod", + "m_attrvectcomms.mod", + "m_attrvect.mod", + "m_attrvectreduce.mod", + "m_chars.mod", + "m_convertmaps.mod", + "mct_mod.mod", + "m_die.mod", + "m_dropdead.mod", + "m_errorhandler.mod", + "m_exchangemaps.mod", + "m_fccomms.mod", + "m_filename.mod", + "m_fileresolv.mod", + "m_flow.mod", + "m_generalgridcomms.mod", + "m_generalgrid.mod", + "m_globalmap.mod", + "m_globalsegmapcomms.mod", + "m_globalsegmap.mod", + "m_globaltolocal.mod", + "m_indexbin_char.mod", + "m_indexbin_integer.mod", + "m_indexbin_logical.mod", + "m_inpak90.mod", + "m_ioutil.mod", + "m_list.mod", + "m_mall.mod", + "m_matattrvectmul.mod", + "m_mctworld.mod", + "m_merge.mod", + "m_mergesorts.mod", + "m_mpif90.mod", + "m_mpif.mod", + "m_mpout.mod", + "m_navigator.mod", + "m_permuter.mod", + "m_rankmerge.mod", + "m_realkinds.mod", + "m_rearranger.mod", + "m_router.mod", + "m_sortingtools.mod", + "m_sparsematrixcomms.mod", + "m_sparsematrixdecomp.mod", + "m_sparsematrix.mod", + "m_sparsematrixplus.mod", + "m_sparsematrixtomaps.mod", + "m_spatialintegral.mod", + "m_spatialintegralv.mod", + "m_stdio.mod", + "m_string.mod", + "m_strtemplate.mod", + "m_traceback.mod", + "m_transfer.mod", + "m_zeit.mod", + ] __libs["mpeu"]["incfiles"] = [] - __libs["psmile.MPI1"]["incfiles"] = [ "mod_oasis_advance.mod", - "mod_oasis_coupler.mod", - "mod_oasis_data.mod", - "mod_oasis_getput_interface.mod", - "mod_oasis_grid.mod", - "mod_oasis_io.mod", - "mod_oasis_ioshr.mod", - "mod_oasis_kinds.mod", - "mod_oasis_method.mod", - "mod_oasis.mod", - "mod_oasis_mpi.mod", - "mod_oasis_namcouple.mod", - "mod_oasis_parameters.mod", - "mod_oasis_part.mod", - "mod_oasis_string.mod", - "mod_oasis_sys.mod", - "mod_oasis_timer.mod", - "mod_oasis_var.mod", - "mod_prism.mod" ] - - __libs["scrip"]["incfiles"] = [ "constants.mod", - "grids.mod", - "iounits.mod", - "kinds_mod.mod", - "mod_oasis_flush.mod", - "netcdf_mod.mod", - "remap_bicubic.mod", - "remap_bicubic_reduced.mod", - "remap_bilinear.mod", - "remap_bilinear_reduced.mod", - "remap_conservative.mod", - "remap_distance_weight.mod", - "remap_gaussian_weight.mod", - "remap_vars.mod", - "remap_write.mod", - "timers.mod" ] + __libs["psmile.MPI1"]["incfiles"] = [ + "mod_oasis_advance.mod", + "mod_oasis_coupler.mod", + "mod_oasis_data.mod", + "mod_oasis_getput_interface.mod", + "mod_oasis_grid.mod", + "mod_oasis_io.mod", + "mod_oasis_ioshr.mod", + "mod_oasis_kinds.mod", + "mod_oasis_method.mod", + "mod_oasis.mod", + "mod_oasis_mpi.mod", + "mod_oasis_namcouple.mod", + "mod_oasis_parameters.mod", + "mod_oasis_part.mod", + "mod_oasis_string.mod", + "mod_oasis_sys.mod", + "mod_oasis_timer.mod", + "mod_oasis_var.mod", + "mod_prism.mod", + ] + + __libs["scrip"]["incfiles"] = [ + "constants.mod", + "grids.mod", + "iounits.mod", + "kinds_mod.mod", + "mod_oasis_flush.mod", + "netcdf_mod.mod", + "remap_bicubic.mod", + "remap_bicubic_reduced.mod", + "remap_bilinear.mod", + "remap_bilinear_reduced.mod", + "remap_conservative.mod", + "remap_distance_weight.mod", + "remap_gaussian_weight.mod", + "remap_vars.mod", + "remap_write.mod", + "timers.mod", + ] def __init__(self, args): super().__init__(args) for k in self.__libs.keys(): self.__libs[k]["filename"] = "lib" + k + ".a" - self.__libs[k]["filerelpath"] = join_path("lib", self.__libs[k]["filename"]) + self.__libs[k]["filerelpath"] = join_path( + "lib", self.__libs[k]["filename"] + ) self.__libs[k]["pcname"] = "oasis3-" + k + ".pc" - self.__libs[k]["pcrelpath"] = join_path("lib", "pkgconfig", self.__libs[k]["pcname"]) - self.__libs[k]["pcpath"] = join_path(self.__pkgdir, self.__libs[k]["pcname"]) + self.__libs[k]["pcrelpath"] = join_path( + "lib", "pkgconfig", self.__libs[k]["pcname"] + ) + self.__libs[k]["pcpath"] = join_path( + self.__pkgdir, self.__libs[k]["pcname"] + ) # Uncomment to print package files and directories # pprint(self.__libs) - def __create_pkgconfig(self, spec, prefix): mkdirp(self.__pkgdir) @@ -182,7 +193,6 @@ def __create_pkgconfig(self, spec, prefix): if nchars_written < len(text): raise OSError - # https://spack-tutorial.readthedocs.io/en/ecp21/tutorial_advanced_packaging.html @property def libs(self): @@ -193,7 +203,6 @@ def libs(self): libraries, root=self.prefix, shared=False, recursive=True ) - def build(self, spec, prefix): # See doc/oasis3mct_UserGuide.pdf: # @@ -203,7 +212,7 @@ def build(self, spec, prefix): print(f"cwd: {srcdir}") makefile_dir = join_path(srcdir, "util", "make_dir") with working_dir(makefile_dir): - with open("make.inc", 'w') as makeinc: + with open("make.inc", "w") as makeinc: makespack = join_path(makefile_dir, "make.spack") makeinc.write(f"include {makespack}") @@ -214,7 +223,6 @@ def build(self, spec, prefix): # Upstream is missing a pkgconfig files, so we'll create them. self.__create_pkgconfig(spec, prefix) - def install(self, spec, prefix): mkdirp(prefix.lib.pkgconfig) @@ -224,16 +232,22 @@ def install(self, spec, prefix): mkdirp(join_path(prefix.include, libname)) - for f in [ self.__libs[libname]["filerelpath"], - self.__libs[libname]["pcrelpath"] ]: - src_dst.append( (join_path(self.__builddir, f), - join_path(prefix, f)) ) + for f in [ + self.__libs[libname]["filerelpath"], + self.__libs[libname]["pcrelpath"], + ]: + src_dst.append( + (join_path(self.__builddir, f), join_path(prefix, f)) + ) for f in self.__libs[libname]["incfiles"]: - src_dst.append( (join_path(self.__incdir, libname, f), - join_path(prefix.include, libname, f)) ) + src_dst.append( + ( + join_path(self.__incdir, libname, f), + join_path(prefix.include, libname, f), + ) + ) # Uncomment to print source and destination tuples # pprint(src_dst) - [install(s,d) for (s,d) in src_dst] - + [install(s, d) for (s, d) in src_dst]