krytarowski created this revision.
krytarowski added a project: LLDB.

The current version of LLDB installs six.py into global python library 
directory. This approach produces conflicts downstream with distribution's 
py-six copy.

Install six.py into subdirectory as this is a common way of handling this 
library in other projects.

As short list (extracted from pkgsrc) is as follows:

- math/py-scipy/PLIST:${PYSITELIB}/scipy/_lib/six.py
- misc/calibre1/PLIST:lib/calibre/six.py
- net/py-dropbox/PLIST:${PYSITELIB}/dropbox/six.py
- 
net/py-google-cloud-sdk/PLIST:${PYPKGPREFIX}-google-cloud-sdk/lib/third_party/requests/packages/urllib3/packages/six.py
- 
net/py-google-cloud-sdk/PLIST:${PYPKGPREFIX}-google-cloud-sdk/platform/gsutil/third_party/boto/boto/vendored/six.py
- 
net/py-google-cloud-sdk/PLIST:${PYPKGPREFIX}-google-cloud-sdk/platform/gsutil/third_party/six/six.py
- print/hplip/PLIST.base:share/hplip/base/six.py

www/py-django/PLIST:${PYSITELIB}/django/utils/six.py

and others.

Downstream projects still can deduplicate a local copy on demand, other ones 
can stop patching LLDB in order to create a package.


Repository:
  rL LLVM

https://reviews.llvm.org/D29405

Files:
  packages/Python/lldbsuite/pre_kill_hook/darwin.py
  packages/Python/lldbsuite/pre_kill_hook/tests/test_darwin.py
  packages/Python/lldbsuite/pre_kill_hook/tests/test_linux.py
  packages/Python/lldbsuite/support/encoded_file.py
  packages/Python/lldbsuite/support/seven.py
  packages/Python/lldbsuite/test/api/listeners/TestListener.py
  packages/Python/lldbsuite/test/decorators.py
  packages/Python/lldbsuite/test/dosep.py
  packages/Python/lldbsuite/test/dotest.py
  
packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
  
packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
  
packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
  packages/Python/lldbsuite/test/lldbcurses.py
  packages/Python/lldbsuite/test/lldbpexpect.py
  packages/Python/lldbsuite/test/lldbplatform.py
  packages/Python/lldbsuite/test/lldbplatformutil.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/lldbutil.py
  packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
  packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
  packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
  packages/Python/lldbsuite/test_event/dotest_channels.py
  packages/Python/lldbsuite/test_event/formatter/pickled.py
  packages/Python/lldbsuite/test_event/formatter/xunit.py
  packages/Python/lldbsuite/test_event/test/src/event_collector.py
  scripts/Python/finishSwigPythonLLDB.py
  scripts/lldb.swig
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  third_party/Python/module/progress/progress.py
  third_party/Python/module/unittest2/unittest2/case.py
  third_party/Python/module/unittest2/unittest2/main.py
  third_party/Python/module/unittest2/unittest2/result.py
  third_party/Python/module/unittest2/unittest2/suite.py
  third_party/Python/module/unittest2/unittest2/test/test_case.py
  third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py

Index: third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py
+++ third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py
@@ -1,5 +1,5 @@
 import unittest2
-import six
+from lldb import six
 
 from unittest2.test.support import LoggingResult
 
Index: third_party/Python/module/unittest2/unittest2/test/test_case.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/test/test_case.py
+++ third_party/Python/module/unittest2/unittest2/test/test_case.py
@@ -1,7 +1,7 @@
 import difflib
 import pprint
 import re
-import six
+from lldb import six
 
 from copy import deepcopy
 
Index: third_party/Python/module/unittest2/unittest2/suite.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/suite.py
+++ third_party/Python/module/unittest2/unittest2/suite.py
@@ -3,7 +3,7 @@
 import sys
 import unittest
 from unittest2 import case, util
-import six
+from lldb import six
 
 __unittest = True
 
Index: third_party/Python/module/unittest2/unittest2/result.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/result.py
+++ third_party/Python/module/unittest2/unittest2/result.py
@@ -6,7 +6,7 @@
 import traceback
 import unittest
 
-from six import StringIO as SixStringIO
+from lldb.six import StringIO as SixStringIO
 
 from unittest2 import util
 from unittest2.compatibility import wraps
Index: third_party/Python/module/unittest2/unittest2/main.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/main.py
+++ third_party/Python/module/unittest2/unittest2/main.py
@@ -3,7 +3,7 @@
 import sys
 import os
 import types
-import six
+from lldb import six
 
 from unittest2 import loader, runner
 try:
Index: third_party/Python/module/unittest2/unittest2/case.py
===================================================================
--- third_party/Python/module/unittest2/unittest2/case.py
+++ third_party/Python/module/unittest2/unittest2/case.py
@@ -7,7 +7,7 @@
 import unittest
 import warnings
 
-import six
+from lldb import six
 
 from unittest2 import result
 from unittest2.util import (
Index: third_party/Python/module/progress/progress.py
===================================================================
--- third_party/Python/module/progress/progress.py
+++ third_party/Python/module/progress/progress.py
@@ -3,7 +3,7 @@
 from __future__ import print_function
 
 import use_lldb_suite
-import six
+from lldb import six
 
 import sys
 import time
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -295,7 +295,7 @@
   // 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')",
+  run_string.Printf("run_one_line (%s, 'from lldb.six.moves import reload_module')",
                     m_dictionary_name.c_str());
   PyRun_SimpleString(run_string.GetData());
 
Index: scripts/lldb.swig
===================================================================
--- scripts/lldb.swig
+++ scripts/lldb.swig
@@ -42,7 +42,7 @@
 import re
 import os
 
-import six
+from lldb import six
 %}
 %include "./Python/python-typemaps.swig"
 
Index: scripts/Python/finishSwigPythonLLDB.py
===================================================================
--- scripts/Python/finishSwigPythonLLDB.py
+++ scripts/Python/finishSwigPythonLLDB.py
@@ -542,7 +542,7 @@
         "six",
         six_module_filename)
     src_file = os.path.normpath(src_file)
-    target = os.path.join(site_packages_dir, six_module_filename)
+    target = os.path.join(site_packages_dir, "lldb", six_module_filename)
 
     if bDbg:
         print((strMsgCopySixPy % (src_file, target)))
Index: packages/Python/lldbsuite/test_event/test/src/event_collector.py
===================================================================
--- packages/Python/lldbsuite/test_event/test/src/event_collector.py
+++ packages/Python/lldbsuite/test_event/test/src/event_collector.py
@@ -7,7 +7,7 @@
 import tempfile
 
 # noinspection PyUnresolvedReferences
-from six.moves import cPickle
+from lldb.six.moves import cPickle
 
 
 def path_to_dotest_py():
Index: packages/Python/lldbsuite/test_event/formatter/xunit.py
===================================================================
--- packages/Python/lldbsuite/test_event/formatter/xunit.py
+++ packages/Python/lldbsuite/test_event/formatter/xunit.py
@@ -17,7 +17,7 @@
 import xml.sax.saxutils
 
 # Third-party modules
-import six
+from lldb import six
 
 # Local modules
 from ..event_builder import EventBuilder
Index: packages/Python/lldbsuite/test_event/formatter/pickled.py
===================================================================
--- packages/Python/lldbsuite/test_event/formatter/pickled.py
+++ packages/Python/lldbsuite/test_event/formatter/pickled.py
@@ -13,7 +13,7 @@
 
 # Our modules
 from .results_formatter import ResultsFormatter
-from six.moves import cPickle
+from lldb.six.moves import cPickle
 
 
 class RawPickledFormatter(ResultsFormatter):
Index: packages/Python/lldbsuite/test_event/dotest_channels.py
===================================================================
--- packages/Python/lldbsuite/test_event/dotest_channels.py
+++ packages/Python/lldbsuite/test_event/dotest_channels.py
@@ -23,7 +23,7 @@
 import socket
 
 # Third-party modules
-from six.moves import cPickle
+from lldb.six.moves import cPickle
 
 # LLDB modules
 
Index: packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
@@ -8,7 +8,7 @@
 import traceback
 import codecs
 
-from six.moves import queue
+from lldb.six.moves import queue
 
 
 def _handle_output_packet_string(packet_contents):
Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
@@ -8,13 +8,13 @@
 import os.path
 import platform
 import re
-import six
+from lldb import six
 import socket_packet_pump
 import subprocess
 import time
 from lldbsuite.test.lldbtest import *
 
-from six.moves import queue
+from lldb.six.moves import queue
 
 
 def _get_debug_monitor_from_lldb(lldb_exe, debug_monitor_basename):
Index: packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
+++ packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
@@ -49,7 +49,7 @@
         # depth of 3 of the 'c' leaf function.
         callsOfA = 0
 
-        from six import StringIO as SixStringIO
+        from lldb.six import StringIO as SixStringIO
         session = SixStringIO()
         while process.GetState() == lldb.eStateStopped:
             thread = lldbutil.get_stopped_thread(
Index: packages/Python/lldbsuite/test/lldbutil.py
===================================================================
--- packages/Python/lldbsuite/test/lldbutil.py
+++ packages/Python/lldbsuite/test/lldbutil.py
@@ -15,8 +15,8 @@
 import time
 
 # Third-party modules
-from six import StringIO as SixStringIO
-import six
+from lldb.six import StringIO as SixStringIO
+from lldb import six
 
 # LLDB modules
 import lldb
Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -53,9 +53,9 @@
 
 # Third-party modules
 import unittest2
-from six import add_metaclass
-from six import StringIO as SixStringIO
-import six
+from lldb.six import add_metaclass
+from lldb.six import StringIO as SixStringIO
+from lldb import six
 
 # LLDB modules
 import use_lldb_suite
Index: packages/Python/lldbsuite/test/lldbplatformutil.py
===================================================================
--- packages/Python/lldbsuite/test/lldbplatformutil.py
+++ packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -10,8 +10,8 @@
 import sys
 
 # Third-party modules
-import six
-from six.moves.urllib import parse as urlparse
+from lldb import six
+from lldb.six.moves.urllib import parse as urlparse
 
 # LLDB modules
 from . import configuration
Index: packages/Python/lldbsuite/test/lldbplatform.py
===================================================================
--- packages/Python/lldbsuite/test/lldbplatform.py
+++ packages/Python/lldbsuite/test/lldbplatform.py
@@ -6,7 +6,7 @@
 import itertools
 
 # Third-party modules
-import six
+from lldb import six
 
 # LLDB modules
 import use_lldb_suite
Index: packages/Python/lldbsuite/test/lldbpexpect.py
===================================================================
--- packages/Python/lldbsuite/test/lldbpexpect.py
+++ packages/Python/lldbsuite/test/lldbpexpect.py
@@ -6,7 +6,7 @@
 import sys
 
 # Third-party modules
-import six
+from lldb import six
 
 # LLDB Modules
 import lldb
Index: packages/Python/lldbsuite/test/lldbcurses.py
===================================================================
--- packages/Python/lldbsuite/test/lldbcurses.py
+++ packages/Python/lldbsuite/test/lldbcurses.py
@@ -7,7 +7,7 @@
 import time
 
 # Third-party modules
-import six
+from lldb import six
 
 # LLDB modules
 
Index: packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
+++ packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
@@ -13,7 +13,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-import six
+from lldb import six
 
 
 class ProcessLaunchTestCase(TestBase):
Index: packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
@@ -8,7 +8,7 @@
 """
 
 from __future__ import print_function
-from six import iteritems
+from lldb.six import iteritems
 
 
 import lldb
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
@@ -3,7 +3,7 @@
 """
 
 from __future__ import print_function
-from six import iteritems
+from lldb.six import iteritems
 
 
 import lldb
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -3,7 +3,7 @@
 """
 
 from __future__ import print_function
-from six import iteritems
+from lldb.six import iteritems
 
 import shutil
 
Index: packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
+++ packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
@@ -1,5 +1,5 @@
 
-import six
+from lldb import six
 
 
 def command(debugger, command, result, internal_dict):
Index: packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
+++ packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
@@ -1,5 +1,5 @@
 
-import six
+from lldb import six
 
 
 def command(debugger, command, result, internal_dict):
Index: packages/Python/lldbsuite/test/dotest.py
===================================================================
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -33,7 +33,7 @@
 import sys
 
 # Third-party modules
-import six
+from lldb import six
 import unittest2
 
 # LLDB Modules
Index: packages/Python/lldbsuite/test/dosep.py
===================================================================
--- packages/Python/lldbsuite/test/dosep.py
+++ packages/Python/lldbsuite/test/dosep.py
@@ -46,8 +46,8 @@
 import sys
 import threading
 
-from six import StringIO
-from six.moves import queue
+from lldb.six import StringIO
+from lldb.six.moves import queue
 
 # Our packages and modules
 import lldbsuite
Index: packages/Python/lldbsuite/test/decorators.py
===================================================================
--- packages/Python/lldbsuite/test/decorators.py
+++ packages/Python/lldbsuite/test/decorators.py
@@ -11,7 +11,7 @@
 import tempfile
 
 # Third-party modules
-import six
+from lldb import six
 import unittest2
 
 # LLDB modules
Index: packages/Python/lldbsuite/test/api/listeners/TestListener.py
===================================================================
--- packages/Python/lldbsuite/test/api/listeners/TestListener.py
+++ packages/Python/lldbsuite/test/api/listeners/TestListener.py
@@ -13,7 +13,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-import six
+from lldb import six
 
 
 class ListenToModuleLoadedEvents (TestBase):
Index: packages/Python/lldbsuite/support/seven.py
===================================================================
--- packages/Python/lldbsuite/support/seven.py
+++ packages/Python/lldbsuite/support/seven.py
@@ -1,4 +1,4 @@
-import six
+from lldb import six
 
 if six.PY2:
     import commands
Index: packages/Python/lldbsuite/support/encoded_file.py
===================================================================
--- packages/Python/lldbsuite/support/encoded_file.py
+++ packages/Python/lldbsuite/support/encoded_file.py
@@ -12,7 +12,7 @@
 import io
 
 # Third party modules
-import six
+from lldb import six
 
 
 def _encoded_read(old_read, encoding):
Index: packages/Python/lldbsuite/pre_kill_hook/tests/test_linux.py
===================================================================
--- packages/Python/lldbsuite/pre_kill_hook/tests/test_linux.py
+++ packages/Python/lldbsuite/pre_kill_hook/tests/test_linux.py
@@ -9,7 +9,7 @@
 from unittest import main, TestCase
 
 # third party
-from six import StringIO
+from lldb.six import StringIO
 
 
 def do_child_thread():
Index: packages/Python/lldbsuite/pre_kill_hook/tests/test_darwin.py
===================================================================
--- packages/Python/lldbsuite/pre_kill_hook/tests/test_darwin.py
+++ packages/Python/lldbsuite/pre_kill_hook/tests/test_darwin.py
@@ -8,7 +8,7 @@
 from unittest import main, TestCase
 
 # third party
-from six import StringIO
+from lldb.six import StringIO
 
 
 def do_child_process(child_work_queue, parent_work_queue, verbose):
Index: packages/Python/lldbsuite/pre_kill_hook/darwin.py
===================================================================
--- packages/Python/lldbsuite/pre_kill_hook/darwin.py
+++ packages/Python/lldbsuite/pre_kill_hook/darwin.py
@@ -6,7 +6,7 @@
 import sys
 
 # third-party module imports
-import six
+from lldb import six
 
 
 def do_pre_kill(process_id, runner_context, output_stream, sample_time=3):
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to