ncl: consolidate patch methods (#44333)
This commit is contained in:
		 Brian Vanderwende
					Brian Vanderwende
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							e53bc780e4
						
					
				
				
					commit
					3433c8b8a5
				
			| @@ -136,18 +136,26 @@ def patch(self): | |||||||
|         # Make configure scripts use Spack's tcsh |         # Make configure scripts use Spack's tcsh | ||||||
|         files = ["Configure"] + glob.glob("config/*") |         files = ["Configure"] + glob.glob("config/*") | ||||||
| 
 | 
 | ||||||
|         filter_file("^#!/bin/csh -f", "#!/usr/bin/env csh", *files) |  | ||||||
| 
 |  | ||||||
|     @run_before("install") |  | ||||||
|     def filter_sbang(self): |  | ||||||
|         # Filter sbang before install so Spack's sbang hook can fix it up |         # Filter sbang before install so Spack's sbang hook can fix it up | ||||||
|         files = glob.glob("ncarg2d/src/bin/scripts/*") |         files += glob.glob("ncarg2d/src/bin/scripts/*") | ||||||
|         files += glob.glob("ncarview/src/bin/scripts/*") |         files += glob.glob("ncarview/src/bin/scripts/*") | ||||||
|         files += glob.glob("ni/src/scripts/*") |         files += glob.glob("ni/src/scripts/*") | ||||||
| 
 | 
 | ||||||
|         csh = join_path(self.spec["tcsh"].prefix.bin, "csh") |         csh = join_path(self.spec["tcsh"].prefix.bin, "csh") | ||||||
| 
 | 
 | ||||||
|         filter_file("^#!/bin/csh", "#!{0}".format(csh), *files) |         filter_file("^#!/bin/csh.*", "#!{0}".format(csh), *files) | ||||||
|  | 
 | ||||||
|  |         if self.spec.satisfies("+grib"): | ||||||
|  |             # Newer versions of libjasper do not provide the inmem property | ||||||
|  |             if self.spec.satisfies("^jasper@2"): | ||||||
|  |                 filter_file("image.inmem_=1;", "", "external/g2clib-1.6.0/enc_jpeg2000.c") | ||||||
|  | 
 | ||||||
|  |             filter_file("SUBDIRS = ", "SUBDIRS = g2clib-1.6.0 ", "external/yMakefile") | ||||||
|  |             filter_file( | ||||||
|  |                 "INC=.*", | ||||||
|  |                 "INC=%s" % self.spec["jasper"].prefix.include, | ||||||
|  |                 "external/g2clib-1.6.0/makefile", | ||||||
|  |             ) | ||||||
| 
 | 
 | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         if (self.compiler.fc is None) or (self.compiler.cc is None): |         if (self.compiler.fc is None) or (self.compiler.cc is None): | ||||||
| @@ -398,16 +406,3 @@ def delete_files(*filenames): | |||||||
|                     os.remove(filename) |                     os.remove(filename) | ||||||
|                 except OSError as e: |                 except OSError as e: | ||||||
|                     raise InstallError("Failed to delete file %s: %s" % (e.filename, e.strerror)) |                     raise InstallError("Failed to delete file %s: %s" % (e.filename, e.strerror)) | ||||||
| 
 |  | ||||||
|     @when("+grib") |  | ||||||
|     def patch(self): |  | ||||||
|         # Newer versions of libjasper do not provide the inmem property |  | ||||||
|         if self.spec.satisfies("^jasper@2"): |  | ||||||
|             filter_file("image.inmem_=1;", "", "external/g2clib-1.6.0/enc_jpeg2000.c") |  | ||||||
| 
 |  | ||||||
|         filter_file("SUBDIRS = ", "SUBDIRS = g2clib-1.6.0 ", "external/yMakefile") |  | ||||||
|         filter_file( |  | ||||||
|             "INC=.*", |  | ||||||
|             "INC=%s" % self.spec["jasper"].prefix.include, |  | ||||||
|             "external/g2clib-1.6.0/makefile", |  | ||||||
|         ) |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user