<div dir="ltr">Todd, Greg, can you guys confirm this is true? The import lldb would succeed if someone had their PYTHONPATH set up just right, but if really none of us care about it, I'm with Tamas in that I'd rather remove it.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 22, 2015 at 2:55 AM Tamas Berghammer <<a href="mailto:tberghammer@google.com">tberghammer@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Zach,<div><br></div><div>I think nobody is using the "<span style="line-height:1.5">if __name__ == '__main__'</span><span style="line-height:1.5">" block as executing a test file directly isn't working at the moment (the "import lldb" command fails). If you plan to change all test file then I would prefer to remove the reference to unittest2 from them for simplicity if nobody have an objection against it.</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">Tamas</span></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr">On Wed, Oct 21, 2015 at 8:57 PM Zachary Turner via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><b>TL;DR - Nobody has to do anything, this is just a heads up that a 400+ file CL is coming.</b></div><div><br></div>IANAL, but I've been told by one that I need to move all third party code used by LLDB to lldb/third_party. Currently there is only one thing there: the Python `six` module used for creating code that is portable across Python 2 and Python 3.<div><br></div><div>The only other 2 instances that I'm aware of are pexpect and unittest2, which are under lldb/test. I've got some patches locally which move pexpect and unittest2 to lldb/third_party. I'll hold off on checking them in for a bit to give people a chance to see this message first, because otherwise you might be surprised when you see a CL with 400 files being checked in.</div><div><br></div><div>Nobody will have to do anything after this CL goes in, and everything should continue to work exactly as it currently does.</div><div><br></div><div>The main reason for the churn is that pretty much every single test in LLDB does something like this:</div><div><br></div><div><div><div><b>import unittest2</b></div></div><div><br></div><div>...</div><div><br></div><div>if __name__ == '__main__':</div><div> import atexit</div><div> lldb.SBDebugger.Initialize()</div><div> atexit.register(lambda: lldb.SBDebugger.Terminate())</div><div> <b>unittest2.main()</b></div></div><div><br></div><div>This worked when unittest2 was a subfolder of test, but not when it's somewhere else. Since LLDB's python code is not organized into a standard python package and we treat the scripts like dotest etc as standalone scripts, the way I've made this work is by introducing a module called <b>lldb_shared </b>under test which, when you import it, fixes up sys.path to correctly add all the right locations under lldb/third_party.</div><div><br></div><div>So, every single test now needs a line at the top to import lldb_shared. </div><div><br></div><div>TBH I don't even know if we need this unittest2 stuff anymore (does anyone even use it?) but even if the answer is no, then that still means changing every file to delete the import statement and the if __name__ == '__main__': block.</div><div><br></div><div>If there are no major concerns I plan to check this in by the end of the day, or tomorrow.</div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
</blockquote></div>
</blockquote></div>