Commit Graph

4 Commits

Author SHA1 Message Date
Mikhail Golubev
9d1044156d PY-58201 Add protection against CWD entries among interpreter paths
The problem was introduced in a5884f47c5f29e20915481944c4ad9390708f752
and then fixed in fb7c98e8df472dbe8cc0510f002fdde72f0b8770.

Namely, for a non-existing value of the system PYTHONPATH we ended up adding
an extra ":" at the end of our PYTHONPATH before running the syspath.py helper.
Whenever Python interpreter encounters a non-absolute entry in PYTHONPATH
it tries to resolve it relatively to the current working directory and for
the PyCharm process on macOS the latter was "/". Hence, we ended up with
the filesystem root among detected interpreter paths and started indexing it.

I added protection against such entries in syspath.py, assuming that no one
is going to intentionally include an IDE's working directory into PYTHONPATH,
as well as handling of an empty list of path entries in
PythonScripts.appendToPythonPath.

GitOrigin-RevId: d1f3ee4b844edf95e0d24e3245ab73b4a39194f5
2023-01-03 21:11:26 +00:00
Mikhail Golubev
d2e5565c9e PY-53088 Make syspath.py helper work regardless of the way it's launched
Previously, it relied on the path the script was launched with to detect and
exclude "helpers" root from the results. Now it uses __file__ to find
the directory it resides in.

GitOrigin-RevId: fd3edce1a6a33fd82607953f75cafa5c558373cd
2022-02-21 13:59:14 +00:00
Dmitry Jemerov
0dd16012b5 ignore literal . in sys.path (happens with IronPython) 2010-08-22 20:47:24 +04:00
Dmitry Jemerov
77c68d6da3 refactoring: store Python script in separate file, not inline in Java code 2010-02-21 00:16:32 +03:00