MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / setup_client_server_paths

Function setup_client_server_paths

pydevd_file_utils.py:718–898  ·  view source on GitHub ↗

paths is the same format as PATHS_FROM_ECLIPSE_TO_PYTHON

(paths)

Source from the content-addressed store, hash-verified

716
717
718def setup_client_server_paths(paths):
719 """paths is the same format as PATHS_FROM_ECLIPSE_TO_PYTHON"""
720
721 global map_file_to_client
722 global map_file_to_server
723 global _last_client_server_paths_set
724 global _next_source_reference
725
726 _last_client_server_paths_set = paths[:]
727
728 _source_reference_to_server_filename.clear()
729 _client_filename_in_utf8_to_source_reference.clear()
730 _next_source_reference = partial(next, itertools.count(1))
731
732 # Work on the client and server slashes.
733 python_sep = "\\" if IS_WINDOWS else "/"
734 eclipse_sep = "\\" if _ide_os == "WINDOWS" else "/"
735
736 norm_filename_to_server_container = {}
737 norm_filename_to_client_container = {}
738
739 initial_paths = []
740 initial_paths_with_end_sep = []
741
742 paths_from_eclipse_to_python = []
743 paths_from_eclipse_to_python_with_end_sep = []
744
745 # Apply normcase to the existing paths to follow the os preferences.
746
747 for i, (path0, path1) in enumerate(paths):
748 force_only_slash = path0.endswith(("/", "\\")) and path1.endswith(("/", "\\"))
749
750 if not force_only_slash:
751 path0 = _fix_path(path0, eclipse_sep, False)
752 path1 = _fix_path(path1, python_sep, False)
753 initial_paths.append((path0, path1))
754 paths_from_eclipse_to_python.append((_normcase_from_client(path0), normcase(path1)))
755
756 # Now, make a version with a slash in the end.
757 path0 = _fix_path(path0, eclipse_sep, True)
758 path1 = _fix_path(path1, python_sep, True)
759 initial_paths_with_end_sep.append((path0, path1))
760 paths_from_eclipse_to_python_with_end_sep.append((_normcase_from_client(path0), normcase(path1)))
761
762 if DEBUG_CLIENT_SERVER_TRANSLATION:
763 pydev_log.critical(
764 "pydev debugger: paths_from_eclipse_to_python %s",
765 ", ".join(
766 [
767 '"%s=>%s"' % (x[0], x[1])
768 for x in paths_from_eclipse_to_python
769 ]
770 ),
771 )
772 # Fix things so that we always match the versions with a slash in the end first.
773 initial_paths = initial_paths_with_end_sep + initial_paths
774 paths_from_eclipse_to_python = paths_from_eclipse_to_python_with_end_sep + paths_from_eclipse_to_python
775

Callers 2

set_ide_osFunction · 0.85

Calls 6

_fix_pathFunction · 0.85
normcaseFunction · 0.85
clearMethod · 0.45
countMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected