Commit Graph

193 Commits

Author SHA1 Message Date
Ankit Kumar Pandey
f46987b828
gh-103708: Make directory layout in sysconfig implementation configurable (#103709) 2023-12-29 17:55:17 +00:00
Tian Gao
c2982380f8
gh-112510: Add readline.backend for the backend readline uses (GH-112511)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2023-12-01 14:05:55 +00:00
Shantanu
385b5d6e09
gh-102038: Skip a sometimes unnecessary stat in site.py (#102039) 2023-04-02 15:47:31 -07:00
Irit Katriel
44bd3fe570
gh-102799: use exception instance instead of sys.exc_info() (#102885) 2023-03-31 11:23:02 +01:00
Nikita Sobolev
745545b5bb
gh-99482: remove jython compatibility parts from stdlib and tests (#99484) 2022-12-23 14:17:24 -06:00
Christian Heimes
5a4af3ab03
gh-90473: disable user site packages on WASI/Emscripten (GH-93633) 2022-06-09 17:45:29 +02:00
Steve Dower
99fcf15052
bpo-45582: Port getpath[p].c to Python (GH-29041)
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.
2021-12-03 00:08:42 +00:00
Eric Snow
b9cdd0fb9c
bpo-45020: Default to using frozen modules unless running from source tree. (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
2021-10-16 13:16:08 -06:00
Inada Naoki
4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
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
2021-03-29 12:28:14 +09:00
pxinwr
ab74c014ae
bpo-31904: Fix site and sysconfig modules for VxWorks RTOS (GH-21821) 2020-12-20 23:27:42 +01:00
Brett Cannon
825ac38332
bpo-42133: update parts of the stdlib to fall back to __spec__.loader when __loader__ is missing (#22929) 2020-11-06 18:45:56 -08:00
idomic
0c71a66b53
bpo-33689: Blank lines in .pth file cause a duplicate sys.path entry (GH-20679) 2020-09-19 22:13:29 +03:00
Steve Dower
dd18001c30
bpo-41627: Distinguish 32 and 64-bit user site packages on Windows (GH-22098)
Also fixes the error message returned when sysconfig fails to interpolate a variable correctly.
2020-09-05 00:45:54 +01:00
Victor Stinner
0ab917e07e
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
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.
2020-07-02 12:43:25 +02:00
native-api
2145c8c972
bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110) 2020-06-12 15:20:11 +09:00
Victor Stinner
8510f43078
bpo-1294959: Add sys.platlibdir attribute (GH-18381)
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>
2020-03-10 09:53:09 +01:00
Daniel Andersson
40c01c3346 Fix typo in site module (GH-17597) 2019-12-14 10:37:58 +00:00
Steve Dower
9048c49322
bpo-37369: Fix initialization of sys members when launched via an app 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
2019-06-29 10:34:11 -07:00
Steve Dower
184f3d4f39 bpo-37364: Use io.open_code() to read .pth files (GH-14299)
https://bugs.python.org/issue37364
2019-06-21 15:16:46 -07:00
Steve Dower
a8474d025c
bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)
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.
2019-02-03 23:19:38 -08:00
Anthony Sottile
b2499669ef bpo-19891: Ignore error while writing history file (GH-8483) 2018-08-06 17:28:19 +09:00
Steve Weber
2487f30d55 bpo-30167: Prevent site.main() exception if PYTHONSTARTUP is set. (GH-6731)
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.
2018-06-10 20:49:34 -04:00
Ned Deily
763f094b1f
bpo-28440: Don't add /Library/Python/3.x/site-packages to sys.path (#5445)
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.
2018-01-30 05:14:09 -05:00
INADA Naoki
5e742fa922 bpo-30804: fix macOS build with framework enabled. (#2516) 2017-06-30 19:38:02 +02:00
Victor Stinner
b01c574ad6 bpo-29585: Define PYTHONFRAMEWORK in PC/pyconfig.h (#2477)
* 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
2017-06-28 18:34:42 +02:00
INADA Naoki
a8f8d5b4bd bpo-29585: optimize site.py startup time (GH-136)
Avoid importing `sysconfig` from `site` by copying minimum code.
Python startup is 5% faster on Linux and 30% faster on macOS
2017-06-29 00:31:53 +09:00
Serhiy Storchaka
55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
INADA Naoki
2e4e011795 bpo-29592: site: skip abs_paths() when it's redundant (GH-167)
Call abs_paths() only if removeduppaths() changed sys.path
2017-03-15 00:52:19 +09:00
Serhiy Storchaka
727ba7c6f4 Issue #28637: No longer use re in site.py.
This makes Python startup from a virtual environment a little faster.
2016-11-08 20:17:35 +02:00
Ned Deily
c6ef503b49 Issue #28323: Remove vestigal MacOS 9 checks from exit() and quit().
Patch by Chi Hsuan Yen.
2016-10-01 21:12:16 -04:00
Steve Dower
313523ce2d Issue #28192: Don't import readline in isolated mode 2016-09-17 12:22:41 -07:00
Steve Dower
4db86bc1b4 Changes pyvenv.cfg trick into an actual sys.path file. 2016-09-09 09:17:35 -07:00
Steve Dower
f5aba58480 Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup 2016-09-06 19:42:27 -07:00
Martin Panter
0b7d84de6b Issue #27171: Merge typo fixes from 3.5 2016-06-02 10:11:18 +00:00
Martin Panter
e26da7c03a Issue #27171: Fix typos in documentation, comments, and test function names 2016-06-02 10:07:09 +00:00
Brett Cannon
5f0507d8ab Issue #26587: Allow .pth files to specify file paths as well as
directories.

Thanks to Wolfgang Langner for the bug report and initial version of
the patch.
2016-04-08 15:04:28 -07:00
Ned Deily
0a85c69f1d Revert back to 3.6.0, buildbots do not want chocolate for 04-01 2016-03-31 19:20:03 -04:00
Victor Stinner
49f324f1d4 Python 8: no pep8, no chocolate! 2016-03-31 23:30:53 +02:00
Serhiy Storchaka
885bdc4946 Issue #25985: sys.version_info is now used instead of sys.version
to format short Python version.
2016-02-11 13:10:36 +02:00
Victor Stinner
e3560a7dc9 site: error on sitecustomize import error
Issue #26099: The site module now writes an error into stderr if sitecustomize
module can be imported but executing the module raise an ImportError. Same
change for usercustomize.
2016-01-22 12:22:07 +01:00
Vinay Sajip
2934fd66ae Closes #25185: merged fix from 3.4. 2015-10-01 11:27:57 +01:00
Vinay Sajip
f223c53218 Closes #25185: Use UTF-8 encoding when reading pyvenv.cfg. 2015-10-01 11:27:00 +01:00
Steve Dower
2d37cb2e1d Fixes sys.path for applocal environments. 2015-07-17 11:59:21 -07:00
Eric Snow
32439d6eb6 Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
Benjamin Peterson
ad9f99e41f merge 3.4 2015-02-01 20:18:29 -05:00
Benjamin Peterson
d40f136d35 https goodness 2015-02-01 20:17:22 -05:00
Antoine Pitrou
9e82b17e9d Issue #21711: support for "site-python" directories has now been removed from the site module (it was deprecated in 3.4). 2014-06-12 19:41:30 -04:00
Ned Deily
5f8784b7cc Issue #21572: Change license command to fallback to generic license URL. 2014-05-30 23:46:19 -07:00
Martin v. Löwis
c00d39e96a Issue #16047: Fix module exception list and __file__ handling in freeze.
Patch by Meador Inge.
2014-03-30 21:07:25 +02:00
Jason R. Coombs
4d91490579 Issue #20411: Use readline.get_current_history_length to check for the presence of a history, rather than get_history_item, which assumes a history is present. 2014-01-28 09:06:58 -05:00