summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
Commit message (Collapse)AuthorAgeFilesLines
* GH-126985: move pyvenv.cfg detection from site to getpath (#126987)Filipe Laíns 🇵🇸2024-11-261-1/+10
|
* gh-122273: Support PyREPL history on Windows (#127141)Victor Stinner2024-11-261-19/+36
| | | Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
* gh-126911: Update credits output (#126913)Stan U.2024-11-181-2/+3
| | | | | | | Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-125140: Remove the current directory from sys.path when using pyrepl ↵Pablo Galindo Salgado2024-10-091-3/+8
| | | | | | | (GH-125212) Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-125096: Don't import _pyrepl in site if PYTHON_BASIC_REPL (#125097)Victor Stinner2024-10-081-7/+19
| | | | | | | If the PYTHON_BASIC_REPL environment variable is set, the site module no longer imports the _pyrepl module. Moreover, the site module now respects -E and -I command line options: ignore PYTHON_BASIC_REPL in this case.
* gh-121790: Fix interactive console initialization (#121793)Milan Oberkirch2024-07-151-4/+1
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-121245: Refactor site.register_readline() (GH-121659)Sergey B Kirpichev2024-07-151-13/+10
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-121103: Put free-threaded libraries in `lib/python3.14t` (#121293)Sam Gross2024-07-111-2/+10
| | | | | On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a "t" suffix to avoid conflicts with a co-located default build installation.
* gh-121245: Amend d611c4c8e9 (correct import) (#121255)Sergey B Kirpichev2024-07-021-2/+1
| | | Co-authored-by: Miro Hrončok <miro@hroncok.cz>
* gh-120417: Add #noqa to used imports in the stdlib (#120421)Victor Stinner2024-06-131-3/+3
| | | | | Tools such as ruff can ignore "imported but unused" warnings if a line ends with "# noqa: F401". It avoids the temptation to remove an import which is used effectively.
* GH-119496: accept UTF-8 BOM in .pth files (GH-119503)Alyssa Coghlan2024-05-241-1/+3
| | | | | | | | | | `Out-File -Encoding utf8` and similar commands in Windows Powershell 5.1 emit UTF-8 with a BOM marker, which the regular `utf-8` codec decodes incorrectly. `utf-8-sig` accepts a BOM, but also works correctly without one. This change also makes .pth files match the way Python source files are handled. Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* gh-119102: Fix REPL for dumb terminal (#119332)Victor Stinner2024-05-211-1/+6
| | | The site module gets the __main__ module to get _pyrepl.__main__.
* gh-119102: Fix REPL for dumb terminal (#119269)Victor Stinner2024-05-211-1/+2
| | | | Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used.
* gh-111201: A new Python REPL (GH-111567)Pablo Galindo Salgado2024-05-051-3/+11
| | | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-77102: site: try utf-8 and fallback to locale encoding when reading .pth ↵Inada Naoki2024-04-161-26/+35
| | | | file (#117802)
* gh-114099: Additions to standard library to support iOS (GH-117052)Russell Keith-Magee2024-03-281-2/+2
| | | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Ned Deily <nad@python.org>
* gh-84995: Run sys.__interactivehook__() on asyncio REPL startup (#20517)Rémi Lapeyre2024-03-011-39/+43
| | | | | | | | | | This makes the asyncio REPL (`python -m asyncio`) more usable and similar to the regular REPL. This exposes register_readline() as a top-level function in site.py, but it's intentionally undocumented. Co-authored-by: Carol Willing <carolcode@willingconsulting.com> Co-authored-by: Itamar Oren <itamarost@gmail.com>
* gh-113659: Skip hidden .pth files (GH-113660)Serhiy Storchaka2024-01-161-1/+11
| | | | Skip .pth files with names starting with a dot or hidden file attribute.
* gh-73965: New environment variable PYTHON_HISTORY (#13208)Zackery Spytz2024-01-071-3/+17
| | | | | | | | It can be used to set the location of a .python_history file --------- Co-authored-by: Levi Sabah <0xl3vi@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-103708: Make directory layout in sysconfig implementation configurable ↵Ankit Kumar Pandey2023-12-291-4/+12
| | | | | | (#103709)
* gh-112510: Add `readline.backend` for the backend readline uses (GH-112511)Tian Gao2023-12-011-2/+1
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* gh-102038: Skip a sometimes unnecessary stat in site.py (#102039)Shantanu2023-04-021-9/+12
|
* gh-102799: use exception instance instead of sys.exc_info() (#102885)Irit Katriel2023-03-311-2/+2
|
* gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)Nikita Sobolev2022-12-231-6/+1
|
* gh-90473: disable user site packages on WASI/Emscripten (GH-93633)Christian Heimes2022-06-091-2/+2
|
* bpo-45582: Port getpath[p].c to Python (GH-29041)Steve Dower2021-12-031-8/+5
| | | | | The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code. This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
* bpo-45020: Default to using frozen modules unless running from source tree. ↵Eric Snow2021-10-161-1/+3
| | | | | | | (gh-28940) The default was "off". Switching it to "on" means users get the benefit of frozen stdlib modules without having to do anything. There's a special-case for running-in-source-tree, so contributors don't get surprised when their stdlib changes don't get used. https://bugs.python.org/issue45020
* bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)Inada Naoki2021-03-291-1/+3
| | | | | | | | | | | See [PEP 597](https://www.python.org/dev/peps/pep-0597/). * Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`. * Add EncodingWarning * Add io.text_encoding() * open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled. * _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python) * bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding(). * What's new entry
* bpo-31904: Fix site and sysconfig modules for VxWorks RTOS (GH-21821)pxinwr2020-12-201-7/+17
|
* bpo-42133: update parts of the stdlib to fall back to `__spec__.loader` when ↵Brett Cannon2020-11-071-2/+9
| | | | `__loader__` is missing (#22929)
* bpo-33689: Blank lines in .pth file cause a duplicate sys.path entry (GH-20679)idomic2020-09-191-0/+2
|
* bpo-41627: Distinguish 32 and 64-bit user site packages on Windows (GH-22098)Steve Dower2020-09-041-1/+2
| | | Also fixes the error message returned when sysconfig fails to interpolate a variable correctly.
* bpo-41193: Ignore OSError in readline write_history() (GH-21279)Victor Stinner2020-07-021-3/+3
| | | | | The write_history() atexit function of the readline completer now ignores any OSError to ignore error if the filesystem is read-only, instead of only ignoring FileNotFoundError and PermissionError.
* bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110)native-api2020-06-121-0/+9
|
* bpo-1294959: Add sys.platlibdir attribute (GH-18381)Victor Stinner2020-03-101-4/+13
| | | | | | | | | | | | | Add --with-platlibdir option to the configure script: name of the platform-specific library directory, stored in the new sys.platlitdir attribute. It is used to build the path of platform-specific dynamic libraries and the path of the standard library. It is equal to "lib" on most platforms. On Fedora and SuSE, it is equal to "lib64" on 64-bit systems. Co-Authored-By: Jan Matějek <jmatejek@suse.com> Co-Authored-By: Matěj Cepl <mcepl@cepl.eu> Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
* Fix typo in site module (GH-17597)Daniel Andersson2019-12-141-1/+1
|
* bpo-37369: Fix initialization of sys members when launched via an app ↵Steve Dower2019-06-291-7/+0
| | | | | | | container (GH-14428) sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
* bpo-37364: Use io.open_code() to read .pth files (GH-14299)Steve Dower2019-06-211-1/+2
| | | https://bugs.python.org/issue37364
* bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)Steve Dower2019-02-041-1/+8
| | | | After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use. Make the same changes for macOS to avoid extra platform checks.
* bpo-19891: Ignore error while writing history file (GH-8483)Anthony Sottile2018-08-061-1/+10
|
* bpo-30167: Prevent site.main() exception if PYTHONSTARTUP is set. (GH-6731)Steve Weber2018-06-111-2/+2
| | | | Before Python 3.6, os.path.abspath(None) used to report an AttributeError which was properly caught inside site.abs_paths, making it ignore __main__, one of sys.modules, which has __file__ and __cached__ set to None. With 3.6, os.path.abspath(None) raises TypeError instead which site.abs_path was not expecting. This resulted in an uncaught exception if a user had PYTHONSTARTUP set and the application called site.main() which a number of third-party programs do.
* bpo-28440: Don't add /Library/Python/3.x/site-packages to sys.path (#5445)Ned Deily2018-01-301-5/+0
| | | | | | | | No longer add /Library/Python/3.x/site-packages, the Apple-supplied system Python site-packages directory, to sys.path for macOS framework builds in case Apple ships a version of Python 3. A similar change was made earlier to Python 2.7 where it was found that the coupling between the system Python and a user-installed framework Python often caused confusion or pip install failures.
* bpo-30804: fix macOS build with framework enabled. (#2516)INADA Naoki2017-06-301-2/+2
|
* bpo-29585: Define PYTHONFRAMEWORK in PC/pyconfig.h (#2477)Victor Stinner2017-06-281-1/+1
| | | | | | | | | | * bpo-29585: Fix PC/pyconfig.h whitespaces Run "make patchcheck". * bpo-29585: Define PYTHONFRAMEWORK in PC/pyconfig.h * site: Fix path separator in _get_path() on Windows
* bpo-29585: optimize site.py startup time (GH-136)INADA Naoki2017-06-281-26/+52
| | | | Avoid importing `sysconfig` from `site` by copying minimum code. Python startup is 5% faster on Linux and 30% faster on macOS
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-1/+1
|
* bpo-29592: site: skip abs_paths() when it's redundant (GH-167)INADA Naoki2017-03-141-1/+6
| | | Call abs_paths() only if removeduppaths() changed sys.path
* Issue #28637: No longer use re in site.py.Serhiy Storchaka2016-11-081-9/+4
| | | | This makes Python startup from a virtual environment a little faster.
* Issue #28323: Remove vestigal MacOS 9 checks from exit() and quit().Ned Deily2016-10-021-3/+1
| | | | Patch by Chi Hsuan Yen.
* Issue #28192: Don't import readline in isolated modeSteve Dower2016-09-171-5/+7
|