Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2016-01-21 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Can this be closed out?


http://reviews.llvm.org/D15209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-04 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Looking at this now.


http://reviews.llvm.org/D15209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-04 Thread Zachary Turner via lldb-commits
Thanks, I'll commit this later today then.

On Fri, Dec 4, 2015 at 10:25 AM Todd Fiala  wrote:

> tfiala accepted this revision.
> tfiala added a comment.
> This revision is now accepted and ready to land.
>
> Hey Zachary,
>
> As best as I can tell, we don't need to do anything here, at least not on
> OS X El Capitan, because six is already included in the OS X Python
> distribution.
>
> I was scratching my head for a while to figure out why, but that seems to
> be it.
>
> I'd be okay with leaving this as is without any Xcode change.  I will be
> cleaning up the "finish" step of the python script handling, much like I
> did for the front end a few weeks ago.  When I do that, Xcode will switch
> to the finisher, and will pick up the "lldb official" in-repo version of
> six we're using.  I'd rather not create the extra work of addressing "which
> six" at this point given that other pending work.
>
> All the tests run on a clean build after with no new errors.  (OS X right
> now seems to have one error and one failure on a clean public system at
> this point, but that is not a result of this change).  I also exercised the
> in-lldb script handling and that seemed to be working.
>
>
> http://reviews.llvm.org/D15209
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-03 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Doesn't look like I can hit this until the morning.   But it'll be first thing 
on my list.


http://reviews.llvm.org/D15209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-03 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: granata.enrico, tfiala.
zturner added a subscriber: lldb-commits.

I think this patch may require some xcode changes.  This is because of the 
`from six.moves import reload_module`.  In the CMake build as part of the swig 
wrapper python script we symlink the `six` module from 
`lldb/third_party/Python/modules/six` to be in LLDB's private 
`lib/site-packages` directory.  This way we can `import six` from within lldb.  

This may not be happening on the Xcode build yet, which if so this will fail on 
Xcode build.  Would someone mind helping me out with this part?  LMK if I 
should submit as is and you fix up the xcode build later, or you want to do it 
as one patch.

http://reviews.llvm.org/D15209

Files:
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -286,10 +286,15 @@
 PyRun_SimpleString (run_string.GetData());
 
 run_string.Clear();
-
 run_string.Printf ("run_one_line (%s, 'import copy, keyword, os, re, sys, 
uuid, lldb')", m_dictionary_name.c_str());
 PyRun_SimpleString (run_string.GetData());
 
+// Reloading modules requires a different syntax in Python 2 and Python 3. 
 This provides
+// a consistent syntax no matter what version of Python.
+run_string.Clear();
+run_string.Printf("run_one_line (%s, 'from six.moves import 
reload_module')", m_dictionary_name.c_str());
+PyRun_SimpleString(run_string.GetData());
+
 // WARNING: temporary code that loads Cocoa formatters - this should be 
done on a per-platform basis rather than loading the whole set
 // and letting the individual formatter classes exploit APIs to check 
whether they can/cannot do their task
 run_string.Clear();
@@ -2626,9 +2631,9 @@
 if (was_imported)
 {
 if (!was_imported_locally)
-command_stream.Printf("import %s ; 
reload(%s)",basename.c_str(),basename.c_str());
+command_stream.Printf("import %s ; 
reload_module(%s)",basename.c_str(),basename.c_str());
 else
-command_stream.Printf("reload(%s)",basename.c_str());
+command_stream.Printf("reload_module(%s)",basename.c_str());
 }
 else
 command_stream.Printf("import %s",basename.c_str());


Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -286,10 +286,15 @@
 PyRun_SimpleString (run_string.GetData());
 
 run_string.Clear();
-
 run_string.Printf ("run_one_line (%s, 'import copy, keyword, os, re, sys, uuid, lldb')", m_dictionary_name.c_str());
 PyRun_SimpleString (run_string.GetData());
 
+// Reloading modules requires a different syntax in Python 2 and Python 3.  This provides
+// a consistent syntax no matter what version of Python.
+run_string.Clear();
+run_string.Printf("run_one_line (%s, 'from six.moves import reload_module')", m_dictionary_name.c_str());
+PyRun_SimpleString(run_string.GetData());
+
 // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set
 // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task
 run_string.Clear();
@@ -2626,9 +2631,9 @@
 if (was_imported)
 {
 if (!was_imported_locally)
-command_stream.Printf("import %s ; reload(%s)",basename.c_str(),basename.c_str());
+command_stream.Printf("import %s ; reload_module(%s)",basename.c_str(),basename.c_str());
 else
-command_stream.Printf("reload(%s)",basename.c_str());
+command_stream.Printf("reload_module(%s)",basename.c_str());
 }
 else
 command_stream.Printf("import %s",basename.c_str());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-03 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Yep - I can make sure this works on Xcode tonight.  I'll either direct send you 
the diff or incorporate it with what you have here.

It probably won't be until much later tonight, but I'll definitely hit this.


http://reviews.llvm.org/D15209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits