[PATCH] D38016: [lit] Make lit stop writing .pyc files

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 17:43:34 PDT 2017


zturner created this revision.
Herald added a reviewer: modocache.

This seems to be causing endless SVN tree conflicts on certain buildbots.  I guess what's happening is that we run the test suite, and the test suite does `import lit.llvm` and that creates a `.pyc` file in the source tree.  Then, svn gets confused when doing an update and refuses to update it because it thinks there's a conflict.

I don't know why this isn't happening for other lit folders (e.g. `lit/formats`), but it definitely seems to be the problem.  I don't know of a better way to fix this then just disabling pyc generation, which I think this does the trick.


https://reviews.llvm.org/D38016

Files:
  llvm/utils/lit/lit.py
  llvm/utils/llvm-lit/llvm-lit.in


Index: llvm/utils/llvm-lit/llvm-lit.in
===================================================================
--- llvm/utils/llvm-lit/llvm-lit.in
+++ llvm/utils/llvm-lit/llvm-lit.in
@@ -3,15 +3,15 @@
 import os
 import sys
 
+sys.dont_write_bytecode = True
+
 config_map = {}
 
 def map_config(source_dir, site_config):
     global config_map
-    source_dir = os.path.realpath(source_dir)
-    source_dir = os.path.normpath(source_dir)
-    source_dir = os.path.normcase(source_dir)
+    source_inode = os.stat(source_dir).st_ino
     site_config = os.path.normpath(site_config)
-    config_map[source_dir] = site_config
+    config_map[source_inode] = site_config
 
 # Variables configured at build time.
 llvm_source_root = "@LLVM_SOURCE_DIR@"
Index: llvm/utils/lit/lit.py
===================================================================
--- llvm/utils/lit/lit.py
+++ llvm/utils/lit/lit.py
@@ -1,4 +1,7 @@
 #!/usr/bin/env python
+import sys
+
+sys.dont_write_bytecode = True
 
 from lit.main import main
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38016.115767.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/8f913bc0/attachment.bin>


More information about the llvm-commits mailing list