servo: Merge #11740 - Added detection for case-sensitive file systems (from perlun:detect-case-sensitive-file-system); r=metajack
authorPer Lundberg <per.lundberg@ecraft.com>
Mon, 27 Jun 2016 12:13:45 -0500
changeset 339137 b2ed4aa1a04542eb0dca5f4dedd70c770469fbd9
parent 339136 9ee21fabd7cde98fa32345db4b88956c4d0dc129
child 339138 096f7c267f4cb11e7498b81007f309faf162c543
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmetajack
servo: Merge #11740 - Added detection for case-sensitive file systems (from perlun:detect-case-sensitive-file-system); r=metajack - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they only change Mach code This is needed for the moment because of a bug in virtualenv (reported upstream). r? @metajack (you were the one who suggested that we check this. I did it in a slightly simpler way since I realized we over-complicated things a bit when talking about it the other day.) Source-Repo: https://github.com/servo/servo Source-Revision: 887376b225d1969b04b8893afffaa4d65ea6ba1a
servo/python/mach_bootstrap.py
--- a/servo/python/mach_bootstrap.py
+++ b/servo/python/mach_bootstrap.py
@@ -155,17 +155,32 @@ def _activate_virtualenv(topdir):
         process.wait()
         if process.returncode:
             sys.exit("Pip failed to execute properly: {}"
                      .format(process.communicate()[1]))
 
         open(marker_path, 'w').close()
 
 
+def _ensure_case_insensitive_if_windows():
+    # The folder is called 'python'. By deliberately checking for it with the wrong case, we determine if the file
+    # system is case sensitive or not.
+    if _is_windows() and not os.path.exists('Python'):
+        print('Cannot run mach in a path on a case-sensitive file system on Windows.')
+        print('For more details, see https://github.com/pypa/virtualenv/issues/935')
+        sys.exit(1)
+
+
+def _is_windows():
+    return sys.platform == 'win32' or sys.platform == 'msys'
+
+
 def bootstrap(topdir):
+    _ensure_case_insensitive_if_windows()
+
     topdir = os.path.abspath(topdir)
 
     # We don't support paths with Unicode characters for now
     # https://github.com/servo/servo/issues/10002
     try:
         topdir.decode('ascii')
     except UnicodeDecodeError:
         print('Cannot run mach in a path with Unicode characters.')