--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -532,26 +532,36 @@ class BaseBootstrapper(object):
return our >= MODERN_RUST_VERSION, our
def cargo_home(self):
cargo_home = os.environ.get('CARGO_HOME',
os.path.expanduser(os.path.join('~', '.cargo')))
cargo_bin = os.path.join(cargo_home, 'bin')
return cargo_home, cargo_bin
+ def win_to_msys_path(self, path):
+ '''Convert a windows-style path to msys style.'''
+ drive, path = os.path.splitdrive(path)
+ path = '/'.join(path.split('\\'))
+ if drive:
+ if path[0] == '/':
+ path = path[1:]
+ path = '/%s/%s' % (drive[:-1], path)
+ return path
+
def print_rust_path_advice(self, template, cargo_home, cargo_bin):
# Suggest ~/.cargo/env if it exists.
if os.path.exists(os.path.join(cargo_home, 'env')):
cmd = 'source %s/env' % cargo_home
else:
# On Windows rustup doesn't write out ~/.cargo/env
# so fall back to a manual PATH update. Bootstrap
# only runs under msys, so a unix-style shell command
# is appropriate there.
- cmd = 'export PATH=%s:$PATH' % cargo_bin
+ cmd = 'export PATH=%s:$PATH' % self.win_to_msys_path(cargo_bin)
print(template % {
'cargo_bin': cargo_bin,
'cmd': cmd,
})
def ensure_rust_modern(self):
modern, version = self.is_rust_modern()