27
27
)
28
28
29
29
30
+
30
31
class _TargetInfo :
31
32
def __init__ (self , triple = None , cross_lib = None , linker = None , link_args = None ):
32
33
self .triple = triple
@@ -88,9 +89,7 @@ def get_target_info(self):
88
89
# we'll target a 32-bit Rust build.
89
90
# Automatic target detection can be overridden via the CARGO_BUILD_TARGET
90
91
# environment variable or --target command line option
91
- if self .target :
92
- return _TargetInfo (self .target )
93
- elif self .plat_name == "win32" :
92
+ if self .plat_name == "win32" :
94
93
return _TargetInfo ("i686-pc-windows-msvc" )
95
94
elif self .plat_name == "win-amd64" :
96
95
return _TargetInfo ("x86_64-pc-windows-msvc" )
@@ -111,7 +110,7 @@ def get_nix_target_info(self):
111
110
112
111
if not host_type or host_type == build_type :
113
112
# not *NIX, or not cross compiling
114
- return _TargetInfo ()
113
+ return _TargetInfo (self . target )
115
114
116
115
stdlib = sysconfig .get_path ("stdlib" )
117
116
cross_lib = os .path .dirname (stdlib )
@@ -128,6 +127,7 @@ def get_nix_target_info(self):
128
127
# hopefully an exact match
129
128
targets = get_rust_target_list ()
130
129
if host_type in targets :
130
+ # FIXME: what if self.target != host_type
131
131
return _TargetInfo (host_type , cross_lib , linker , linker_args )
132
132
133
133
# the vendor field can be ignored, so x86_64-pc-linux-gnu is compatible
@@ -137,8 +137,12 @@ def get_nix_target_info(self):
137
137
components [1 ] = "unknown"
138
138
host_type2 = "-" .join (components )
139
139
if host_type2 in targets :
140
+ # FIXME: what if self.target != host_type2
140
141
return _TargetInfo (host_type2 , cross_lib , linker , linker_args )
141
142
143
+ if self .target :
144
+ return _TargetInfo (self .target , cross_lib )
145
+
142
146
raise DistutilsPlatformError (
143
147
"Don't know the correct rust target for system type %s. Please "
144
148
"set the CARGO_BUILD_TARGET environment variable." % host_type
0 commit comments