homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils.sysconfig.get_python_lib gives surprising result when used with a Python build
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.7, Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Arfrever, alexis, carljm, dstufft, eric.araujo, kesara, rbcollins, steve.dower, tarek, vinay.sajip, ysj.ray
Priority: normal Keywords: easy, patch

Created on 2009年05月22日 12:39 by vinay.sajip, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils_sysconfig.diff vinay.sajip, 2010年09月13日 06:06 Patch for distutils/sysconfig.py
sysconfig.diff vinay.sajip, 2010年09月13日 06:07 Patch for sysconfig.py
libdir.py vinay.sajip, 2011年03月28日 11:02 Simple script which prints include/lib/makefile settings
6087_distutils_sysconfig.diff kesara, 2016年09月13日 04:11
6087_sysconfig.diff kesara, 2016年09月13日 04:11
fix-6087.diff vinay.sajip, 2016年09月18日 13:31 review
Messages (26)
msg88194 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009年05月22日 12:39
When used with a build from source (i.e. non-installed) of Python,
get_python_lib gives the result (on Linux)
[prefix]/lib/python[version]
Shouldn't this be [prefix]/Lib?
Note that get_python_inc() returns "Include". That's because it makes
use of the "python_build" flag which is set for builds from source.
msg102703 - (view) Author: ysj.ray (ysj.ray) Date: 2010年04月09日 08:59
Yes, I agree with you, this may be a bug? 
Seemingly, the sysconfig.get_python_lib() should act just like the get_python_inc() function, return "[prefix]/lib/python[version]" in case of "python_build" flag is False, and "[prefix]/Lib" in case of "python_build" flag is True.
msg115843 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年09月08日 02:42
What ./configure line did you use?
msg115879 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2010年09月08日 15:01
Just plain
./configure
as far as I remember.
msg116253 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年09月12日 23:36
Can you propose a patch? Also, can you say if the bug exists with the new sysconfig.get_path in 2.7 and 3.2? (I can’t test right now, I ./configure with a --prefix, which logically gets used in the paths).
msg116278 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2010年09月13日 06:06
Attached is a patch for distutils/sysconfig.py.
msg116279 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2010年09月13日 06:07
Attached is a patch for sysconfig.py.
msg116280 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2010年09月13日 06:13
N.B. without the sysconfig.py patch, sysconfig.get_path() fails, but differently.
With the patch, sysconfig.get_path('stdlib') and sysconfig.get_path('include') give the expected values, but _CONFIG_VARS['srcdir'] still seems wrong:
vinay@eta-jaunty:/tmp$ python3.2
Python 3.2a2+ (py3k:84759, Sep 13 2010, 05:14:55) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig._CONFIG_VARS['srcdir']
'/tmp'
>>> 
Someone please take a look!
msg131570 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年03月20日 23:34
The patches look good, thank you. Do you have a command, script or test that would print the values, to make sure they’re right?
msg132124 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年03月25日 17:48
get_makefile_filename also fails when run from a checkout.
msg132392 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011年03月28日 11:02
Attached is a simple script to show include and lib paths.
The makefile location seems OK on my system.
msg132648 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011年03月31日 11:02
Actually, the makefile location *is* wrong - ignore my last comment contradicting that.
msg132691 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年03月31日 17:58
I’m not sure yet whether this is a bug or a new feature, but when python runs from an uninstalled build, I would like paths to refer to the source directory, not the default configure prefix.
msg138608 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年06月18日 21:45
See also #12141.
msg146949 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年11月03日 17:21
> I’m not sure yet whether this is a bug or a new feature, but when python runs from an
> uninstalled build, I would like paths to refer to the source directory, not the default
> configure prefix.
I need this fixed for packaging and it may affect venv too, so I will consider it a bug, fix it and wait for the python-dev response :)
msg247120 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015年07月22日 14:41
Moving this back to patch review since I'm 90% sure that the patch won't apply anymore (if I had a little more time I'd pull it down and double check) - but I've hit this myself and would totally commit it if updated.
msg276156 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月13日 04:10
This issue still exists in Python 3.7.
msg276157 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月13日 04:11
Updated patch based on vinay.sajip's patch.
msg276158 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月13日 04:11
Updated patch based on vinay.sajip's patch.
msg276165 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月13日 04:35
These patches break both test_distutils & test_sysconfig tests.
msg276168 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2016年09月13日 04:45
Ok, so we need to figure out whether the tests are wrong, or the 'fix' is wrong.
msg276169 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月13日 04:47
Test output:
[cpython.25567]$ ./python.exe -m test test_distutils test_sysconfig -j3
Run tests in parallel using 3 child processes
0:00:01 [1/2/1] test_sysconfig failed
test test_sysconfig failed -- Traceback (most recent call last):
 File "/Users/kesara/pycon/cpython.25567/Lib/test/test_sysconfig.py", line 283, in test_user_similar
 self.assertEqual(user_path, global_path.replace(base, user, 1))
AssertionError: '/Users/kesara/.local/lib/python3.6' != '/Users/kesara/pycon/cpython.25567/Lib'
- /Users/kesara/.local/lib/python3.6
+ /Users/kesara/pycon/cpython.25567/Lib
0:00:05 [2/2/2] test_distutils failed
test test_distutils failed -- Traceback (most recent call last):
 File "/Users/kesara/pycon/cpython.25567/Lib/distutils/tests/test_sysconfig.py", line 40, in test_get_python_lib
 sysconfig.get_python_lib(prefix=TESTFN))
AssertionError: '/Users/kesara/pycon/cpython.25567/Lib' == '/Users/kesara/pycon/cpython.25567/Lib'
2 tests failed:
 test_distutils test_sysconfig
Total duration: 6 sec
Tests result: FAILURE
msg276284 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2016年09月13日 15:04
> Ok, so we need to figure out whether the tests are wrong, or the 'fix' is wrong.
The tests were never updated, so most likely they will need changing. I was waiting for feedback about my point about _CONFIG_VARS['srcdir'], but I never got any at the time ... will look at updating the patch with updated tests.
msg276890 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2016年09月18日 13:31
Updated patch to cover tests, and changed the implementation slightly. Tests pass on Linux and Windows (I'm not able to build on OS X). The patch is against the default branch but the diff should apply equally well to 3.6.
msg276998 - (view) Author: Kesara Rathnayake (kesara) Date: 2016年09月20日 02:59
fix-6087.diff passes on OSX (Python 3.6)
$ ./python.exe -m test test_distutils test_sysconfig -j3
Run tests in parallel using 3 child processes
0:00:01 [1/2] test_sysconfig passed
0:00:13 [2/2] test_distutils passed
All 2 tests OK.
Total duration: 14 sec
Tests result: SUCCESS
msg386361 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021年02月03日 18:21
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.
If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools 
History
Date User Action Args
2022年04月11日 14:56:49adminsetgithub: 50337
2021年02月03日 18:21:29steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386361

resolution: out of date
stage: patch review -> resolved
2016年09月20日 02:59:41kesarasetmessages: + msg276998
2016年09月18日 13:31:31vinay.sajipsetfiles: + fix-6087.diff

messages: + msg276890
2016年09月13日 15:04:53vinay.sajipsetmessages: + msg276284
2016年09月13日 04:47:33kesarasetmessages: + msg276169
2016年09月13日 04:45:50rbcollinssetmessages: + msg276168
2016年09月13日 04:35:18kesarasetmessages: + msg276165
2016年09月13日 04:11:31kesarasetfiles: + 6087_sysconfig.diff

messages: + msg276158
2016年09月13日 04:11:14kesarasetfiles: + 6087_distutils_sysconfig.diff

messages: + msg276157
2016年09月13日 04:10:40kesarasetnosy: + kesara

messages: + msg276156
versions: + Python 3.7
2015年07月22日 14:41:46rbcollinssetversions: + Python 3.6
nosy: + rbcollins

messages: + msg247120

stage: commit review -> patch review
2014年07月05日 22:04:58BreamoreBoysetnosy: + dstufft

components: - Distutils2
versions: + Python 3.4, Python 3.5, - 3rd party, Python 2.7, Python 3.2, Python 3.3
2011年11月03日 17:21:51eric.araujosetmessages: + msg146949
versions: - Python 3.1
2011年06月18日 21:45:25eric.araujosetmessages: + msg138608
2011年04月01日 18:24:51carljmsetnosy: + carljm
2011年03月31日 17:58:53eric.araujosetmessages: + msg132691
2011年03月31日 11:02:24vinay.sajipsetmessages: + msg132648
2011年03月28日 11:02:30vinay.sajipsetfiles: + libdir.py

messages: + msg132392
2011年03月25日 17:48:37eric.araujosetmessages: + msg132124
2011年03月20日 23:34:35eric.araujosetkeywords: + patch, easy, - needs review, buildbot
nosy: + alexis

stage: commit review
2011年03月20日 23:34:00eric.araujosetnosy: - alexis
versions: + Python 3.3
messages: + msg131570

assignee: tarek -> eric.araujo
keywords: + needs review, buildbot, - patch, easy
2011年02月13日 14:49:29alexissetnosy: + alexis
2010年09月29日 23:43:53eric.araujosetversions: + 3rd party
2010年09月13日 06:13:47vinay.sajipsetmessages: + msg116280
2010年09月13日 06:07:31vinay.sajipsetfiles: + sysconfig.diff

messages: + msg116279
2010年09月13日 06:06:28vinay.sajipsetfiles: + distutils_sysconfig.diff
keywords: + patch
messages: + msg116278
2010年09月12日 23:36:16eric.araujosetnosy: vinay.sajip, tarek, eric.araujo, Arfrever, ysj.ray
messages: + msg116253
components: + Distutils2
versions: + Python 3.1, - Python 2.6
2010年09月08日 18:04:04Arfreversetnosy: + Arfrever
2010年09月08日 15:01:59vinay.sajipsetmessages: + msg115879
2010年09月08日 02:42:18eric.araujosetmessages: + msg115843
2010年04月09日 09:00:28ysj.raysetversions: + Python 2.6, Python 3.2
2010年04月09日 09:00:06ysj.raysetversions: + Python 2.7, - Python 3.2
2010年04月09日 08:59:13ysj.raysetnosy: + ysj.ray

messages: + msg102703
versions: + Python 3.2, - Python 2.6, Python 2.7
2010年04月09日 00:24:23eric.araujosetnosy: + eric.araujo
2009年05月22日 12:39:09vinay.sajipcreate

AltStyle によって変換されたページ (->オリジナル) /