<div dir="ltr">No, we won't need/want to revert. I just wanted to see if you already had a snazzy script I could whiz through a directory tree with.<div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 2, 2015 at 10:26 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Also, one last thing. The reason this is probably wreaking havoc on your stuff internally is because I removed scriptDir from sys.path (diff the changes of dotest.py to see). I think it should stay removed upstream (mucking with sys.path so you can import from a parent directory is a bad thing to do), but if you have a fork it might be worth putting it back into the fork temporarily to get things green? Note that technically stuff will still be "broken" the same way it was before (importing a second copy of a module), but that only ever leads to an actual problem fi you rely on global state from the module - which upstream anyway we were only ever doing for lldbtest_config.<div><br></div><div>If worse comes to worse we can revert, but if so I think somehow we should figure out a strategy for getting this back in, because it definitely seems like "the right way"</div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 2, 2015 at 10:14 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@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">Also as far as I can tell, X has to be in the following set: [lldbutil, lldbtest, lldbinline, lldbbench]. In theory there are other possibilities (any .py file that is in packages/Python/lldbsuite/test is fair game) but I don't think I encountered any aside from those 4.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 2, 2015 at 10:12 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@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"><div class="gmail_quote"><div dir="ltr">On Mon, Nov 2, 2015 at 10:02 PM Todd Fiala <<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.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">Do you have a script you used to tweak these?<div><br></div><div>(We have a ton of stuff broken internally on this that I need to fix up).</div><div><br></div><div>We're starting to need to do quite a bit of extra typing for the package structure :-/</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><span style="font-size:13px;line-height:19.5px">No, I just used a recursive regex replacement. I had to find a few different patterns:</span><div style="font-size:13px;line-height:19.5px"><br></div><div style="font-size:13px;line-height:19.5px">from X import foo # from lldbsuite.test.X import foo</div><div style="font-size:13px;line-height:19.5px">import X # import lldbsuite.test.X as X</div><div style="font-size:13px;line-height:19.5px">import foo, X #import foo\nimport lldbsuite.test.X as X</div><div style="font-size:13px;line-height:19.5px"><br></div><div style="font-size:13px;line-height:19.5px">and I handled each one on a case-by-case basis.</div><div style="font-size:13px;line-height:19.5px"><br></div><div style="font-size:13px;line-height:19.5px">Luckily the extra typing only comes at the import site. If you use the syntax I suggested in #2 and #3 above (import lldbsuite.test.X as X) then the syntax at any sites where you use a definition from inside the module are the same.</div><div style="font-size:13px;line-height:19.5px"><br></div><div style="font-size:13px;line-height:19.5px">I was a little bit annoyed at the extra typing myself, but when I look into it, it's considered a "feature". See <a href="https://www.python.org/dev/peps/pep-0328/" target="_blank">PEP 0328 - Imports: Multi-Line and Absolute/Relative</a> and as far as I can tell the way we were doing things before was considered "wrong" :(</div><div style="font-size:13px;line-height:19.5px"><br></div><div><span style="font-size:13px;line-height:19.5px">How much of a problem is this going to be on your side? Is there an equally "good" solution that doesn't require so much fixup on your side?</span></div><div><span style="font-size:13px;line-height:19.5px"><br></span></div><div><span style="font-size:13px;line-height:19.5px">the only fixup I encountered was in individual test cases and test suites (i.e. files that are loaded by unittest2). Does this account for all the test failures on your side as well, or is there something else going on I missed?</span></div></div></div></blockquote></div></blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">-Todd</div></div>
</div>