imported patch xargsFix draft
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 28 Dec 2016 14:44:09 +0100
changeset 454198 6588fd305dd2c8b7a5ea187c6769dcf85b8af72f
parent 454127 d7b6af32811bddcec10a47d24bd455a1ec1836fc
child 454199 8e440c88026a0ea7d1447c0f4e70cda7c7f77b7c
push id39863
push userarchaeopteryx@coole-files.de
push dateWed, 28 Dec 2016 14:44:26 +0000
milestone53.0a1
imported patch xargsFix MozReview-Commit-ID: 44UUE5VXXK4
python/mozboot/mozboot/base.py
--- 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()