@@ -613,7 +613,7 @@ def wrapper(*args, **kwargs):
613613 return func (* args , ** kwargs )
614614 base_dir = common ().DATA_DIR / "toolchain"
615615 toolchain = base_dir / common ().get_triplet ()
616- cargo_home = str ( common (). DATA_DIR / "cargo" )
616+ cargo_home = install_cargo_config . tmpdir . name
617617 if not toolchain .exists ():
618618 debug ("Unable to set CARGO_HOME no toolchain exists" )
619619 else :
@@ -750,12 +750,38 @@ def wrap_req_install(name):
750750 mod = importlib .import_module (name )
751751
752752 def wrap (func ):
753- if mod .InstallRequirement .install .__code__ .co_argcount == 9 :
753+ if mod .InstallRequirement .install .__code__ .co_argcount == 7 :
754+ @functools .wraps (func )
755+ def wrapper (
756+ self ,
757+ root = None ,
758+ home = None ,
759+ prefix = None ,
760+ warn_script_location = True ,
761+ use_user_site = False ,
762+ pycompile = True ,
763+ ):
764+ try :
765+ if TARGET .TARGET :
766+ TARGET .INSTALL = True
767+ home = TARGET .PATH
768+ return func (
769+ self ,
770+ root ,
771+ home ,
772+ prefix ,
773+ warn_script_location ,
774+ use_user_site ,
775+ pycompile ,
776+ )
777+ finally :
778+ TARGET .INSTALL = False
779+
780+ elif mod .InstallRequirement .install .__code__ .co_argcount == 8 :
754781
755782 @functools .wraps (func )
756783 def wrapper (
757784 self ,
758- install_options ,
759785 global_options = None ,
760786 root = None ,
761787 home = None ,
@@ -770,7 +796,6 @@ def wrapper(
770796 home = TARGET .PATH
771797 return func (
772798 self ,
773- install_options ,
774799 global_options ,
775800 root ,
776801 home ,
@@ -783,10 +808,12 @@ def wrapper(
783808 TARGET .INSTALL = False
784809
785810 else :
811+ # Oldest version of this method sigature with 9 arguments.
786812
787813 @functools .wraps (func )
788814 def wrapper (
789815 self ,
816+ install_options ,
790817 global_options = None ,
791818 root = None ,
792819 home = None ,
@@ -801,6 +828,7 @@ def wrapper(
801828 home = TARGET .PATH
802829 return func (
803830 self ,
831+ install_options ,
804832 global_options ,
805833 root ,
806834 home ,
@@ -844,9 +872,13 @@ def install_cargo_config():
844872 # We need this as a late import for python < 3.12 becuase importing it will
845873 # load the ssl module. Causing out setup_openssl method to fail to load
846874 # fips module.
847- dirs = common ().work_dirs ()
875+ import tempfile
876+
877+ install_cargo_config .tmpdir = tempfile .TemporaryDirectory (prefix = "relenvcargo" )
878+ cargo_home = pathlib .Path (install_cargo_config .tmpdir .name )
879+
848880 triplet = common ().get_triplet ()
849- cargo_home = dirs . data / "cargo"
881+ # dirs = common().work_dirs()
850882
851883 toolchain = common ().get_toolchain ()
852884 if not toolchain :
0 commit comments