r: do not create dir in setup_dependent_package (#46282)
This commit is contained in:
		@@ -5,6 +5,7 @@
 | 
			
		||||
from typing import Optional, Tuple
 | 
			
		||||
 | 
			
		||||
import llnl.util.lang as lang
 | 
			
		||||
from llnl.util.filesystem import mkdirp
 | 
			
		||||
 | 
			
		||||
from spack.directives import extends
 | 
			
		||||
 | 
			
		||||
@@ -36,6 +37,7 @@ def configure_vars(self):
 | 
			
		||||
 | 
			
		||||
    def install(self, pkg, spec, prefix):
 | 
			
		||||
        """Installs an R package."""
 | 
			
		||||
        mkdirp(pkg.module.r_lib_dir)
 | 
			
		||||
 | 
			
		||||
        config_args = self.configure_args()
 | 
			
		||||
        config_vars = self.configure_vars()
 | 
			
		||||
@@ -43,12 +45,12 @@ def install(self, pkg, spec, prefix):
 | 
			
		||||
        args = ["--vanilla", "CMD", "INSTALL"]
 | 
			
		||||
 | 
			
		||||
        if config_args:
 | 
			
		||||
            args.append("--configure-args={0}".format(" ".join(config_args)))
 | 
			
		||||
            args.append(f"--configure-args={' '.join(config_args)}")
 | 
			
		||||
 | 
			
		||||
        if config_vars:
 | 
			
		||||
            args.append("--configure-vars={0}".format(" ".join(config_vars)))
 | 
			
		||||
            args.append(f"--configure-vars={' '.join(config_vars)}")
 | 
			
		||||
 | 
			
		||||
        args.extend(["--library={0}".format(self.pkg.module.r_lib_dir), self.stage.source_path])
 | 
			
		||||
        args.extend([f"--library={pkg.module.r_lib_dir}", self.stage.source_path])
 | 
			
		||||
 | 
			
		||||
        pkg.module.R(*args)
 | 
			
		||||
 | 
			
		||||
@@ -79,27 +81,21 @@ class RPackage(Package):
 | 
			
		||||
    @lang.classproperty
 | 
			
		||||
    def homepage(cls):
 | 
			
		||||
        if cls.cran:
 | 
			
		||||
            return "https://cloud.r-project.org/package=" + cls.cran
 | 
			
		||||
            return f"https://cloud.r-project.org/package={cls.cran}"
 | 
			
		||||
        elif cls.bioc:
 | 
			
		||||
            return "https://bioconductor.org/packages/" + cls.bioc
 | 
			
		||||
            return f"https://bioconductor.org/packages/{cls.bioc}"
 | 
			
		||||
 | 
			
		||||
    @lang.classproperty
 | 
			
		||||
    def url(cls):
 | 
			
		||||
        if cls.cran:
 | 
			
		||||
            return (
 | 
			
		||||
                "https://cloud.r-project.org/src/contrib/"
 | 
			
		||||
                + cls.cran
 | 
			
		||||
                + "_"
 | 
			
		||||
                + str(list(cls.versions)[0])
 | 
			
		||||
                + ".tar.gz"
 | 
			
		||||
            )
 | 
			
		||||
            return f"https://cloud.r-project.org/src/contrib/{cls.cran}_{str(list(cls.versions)[0])}.tar.gz"
 | 
			
		||||
 | 
			
		||||
    @lang.classproperty
 | 
			
		||||
    def list_url(cls):
 | 
			
		||||
        if cls.cran:
 | 
			
		||||
            return "https://cloud.r-project.org/src/contrib/Archive/" + cls.cran + "/"
 | 
			
		||||
            return f"https://cloud.r-project.org/src/contrib/Archive/{cls.cran}/"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def git(self):
 | 
			
		||||
        if self.bioc:
 | 
			
		||||
            return "https://git.bioconductor.org/packages/" + self.bioc
 | 
			
		||||
            return f"https://git.bioconductor.org/packages/{self.bioc}"
 | 
			
		||||
 
 | 
			
		||||
@@ -297,8 +297,3 @@ def setup_dependent_package(self, module, dependent_spec):
 | 
			
		||||
 | 
			
		||||
        # Add variable for library directry
 | 
			
		||||
        module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir)
 | 
			
		||||
 | 
			
		||||
        # Make the site packages directory for extensions, if it does not exist
 | 
			
		||||
        # already.
 | 
			
		||||
        if dependent_spec.package.is_extension:
 | 
			
		||||
            mkdirp(module.r_lib_dir)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user