classification
Title: distutils.sysconfig.get_python_lib gives surprising result when used with a Python build
Type: behavior Stage: commit review
Components: Distutils, Distutils2 Versions: Python 3.3, Python 3.2, Python 2.7, 3rd party
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Arfrever, alexis, carljm, eric.araujo, tarek, vinay.sajip, ysj.ray
Priority: normal Keywords: easy, patch

Created on 2009-05-22 12:39 by vinay.sajip, last changed 2011-11-03 17:21 by eric.araujo.

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
Messages (15)
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 :)
History
Date User Action Args
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