FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-46933: Make pwd module optional (GH-31700) by tiran · Pull Request #31700 · python/cpython · GitHub

/ cpython Public

bpo-46933: Make pwd module optional (GH-31700) - #31700

Merged
tiran merged 3 commits into
python:mainfrom
tiran:no-pwd
Mar 7, 2022
Merged

bpo-46933: Make pwd module optional (GH-31700)#31700
tiran merged 3 commits into
python:mainfrom
tiran:no-pwd

Conversation

tiran commented Mar 5, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Contributor

Hm, for some reason, configure now decides not to build pwd on my Mac, thus breaking posixpath.expanduser for my username:

$ python3.11
Python 3.11.0a5 (v3.11.0a5:c4e4b91557, Feb  3 2022, 14:54:01) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import posixpath
>>> posixpath.expanduser("~erlendaasland")
'/Users/erlendaasland'
>>> ^D
$ ./python.exe                 
Python 3.11.0a5+ (heads/no-pwd-dirty:a6ca976941, Mar  6 2022, 00:31:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import posixpath
>>> posixpath.expanduser("~erlendaasland")
'~erlendaasland'
>>> ^D

getpwuid and getpwuid_r are both available, so I don't see why.

$ grep getpwuid config.cache
ac_cv_func_getpwuid=${ac_cv_func_getpwuid=yes}
ac_cv_func_getpwuid_r=${ac_cv_func_getpwuid_r=yes}

Copy link
Copy Markdown
Contributor

Aaaah, I see it!

cpython/configure.ac

Lines 6465 to 6466 in 6927632

AS_CASE([$py_stdlib_not_available],
[*$1*], [modstate=n/a],

[Darwin/*], [py_stdlib_not_available="ossaudiodev spwd"],

erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We need to use m4_foreach_w (or m4_map_args_w) in PY_STDLIB_MOD and PY_STDLIB_MOD_SIMPLE when checking py_stdlib_not_available for unavailable modules. There may be a more elegant solution.

tiran commented Mar 6, 2022

Copy link
Copy Markdown
Member Author

We need to use m4_foreach_w (or m4_map_args_w) in PY_STDLIB_MOD and PY_STDLIB_MOD_SIMPLE when checking py_stdlib_not_available for unavailable modules. There may be a more elegant solution.

I tried m4_set_add_all but it didn't work like I hoped. The m4 set functions seem to get evaluated during autoconf. We need to evaluate them when configure is running.

Copy link
Copy Markdown
Contributor

The m4 set functions seem to get evaluated during autoconf. We need to evaluate them when configure is running.

Yeah, I tried some experiments with the m4 wrappers yesterday, but they didn't work out.

tiran commented Mar 6, 2022

Copy link
Copy Markdown
Member Author

Yeah, I tried some experiments with the m4 wrappers yesterday, but they didn't work out.

We may have to restructure the test. I have a working solution, will clean it up and push it later today.

erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yep, this approach works swell. Tested on my mac; all good. I left some comments nits; do with them as you please :)

Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
tiran changed the title bpo-46933: Make pwd module optional bpo-46933: Make pwd module optional (GH-31700) Mar 7, 2022
tiran merged commit ca9689f into python:main Mar 7, 2022
tiran deleted the no-pwd branch March 7, 2022 12:36
erlend-aasland pushed a commit to erlend-aasland/cpython that referenced this pull request Mar 7, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL