classification
Title: distutils docs: data_files always uses sys.prefix
Type: behavior Stage: patch review
Components: Distutils, Documentation Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, docs@python, dstufft, eric.araujo, jdemeyer
Priority: normal Keywords: patch

Created on 2015-11-10 06:06 by jdemeyer, last changed 2018-10-10 06:16 by jdemeyer.

Pull Requests
URL Status Linked Edit
PR 9767 open jdemeyer, 2018-10-09 13:12
Messages (9)
msg254432 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2015-11-10 06:06
The documentation for distutils claims that sys.exec_prefix is used in certain cases to install data_files, but this is simply not true (maybe it was true in the past or this sentence was copy/pasted from somewhere else?)
msg327403 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2018-10-09 14:10
If you’re not sure about the reason for that sentence, I think you should not remove it from the docs but investigate more (look at the history, test the conditions (package with extension module), etc).
msg327407 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2018-10-09 14:23
> If you’re not sure about the reason for that sentence, I think you should not remove it from the docs

If the docs are wrong, their history doesn't matter that much: the docs should be fixed regardless.

> test the conditions (package with extension module)

I did that before posting this bug report. I also looked at the distutils sources. I couldn't find any evidence that data_files are ever installed in sys.exec_prefix.
msg327408 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2018-10-09 14:24
Just for fun, let's look at the history. That piece of documentation goes back to

commit 632bda3aa06879396561dde5ed3d93ee8fb8900c
Author: Fred Drake <fdrake@acm.org>
Date:   Fri Mar 8 22:02:06 2002 +0000

    Add more explanation of how data_files is used (esp. where the files end up
    in the installation and how that location is determined).

I haven't tried to compile that Python version from 2002 but the distutils sources from that time look quite close to what they are today (scary, no?). So my gut feeling is that those docs were wrong even at the time that they were written.
msg327412 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2018-10-09 14:40
There is also

commit fa2f4b6d8e297eda09d8ee52dc4a3600b7d458e7
Author: Greg Ward <gward@python.net>
Date:   Sat Jun 24 17:22:39 2000 +0000

    Changed the default installation directory for data files (used by
    the "install_data" command to the installation base, which is usually just
    sys.prefix.  (Any setup scripts out there that specify data files will have
    to set the installation directory, relative to the base, explicitly.)

with commit message stating that data_files are installed in sys.prefix.
msg327413 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2018-10-09 14:45
> If the docs are wrong, their history doesn't matter that much

What I was saying is that I am not sure that the docs are wrong.

Distutils is more touchy that the rest of the stdlib and I err on the side of caution.
msg327415 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2018-10-09 15:00
Well, I did try it on a minimal Python project. I also read the distutils sources and understood why it installs data_files in sys.prefix by default. So what more do you need to be convinced?
msg327416 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2018-10-09 15:02
Did you try with a minimal project containing a C extension?

Did you install in a system where sys.prefix != sys.exec_prefix?
msg327455 - (view) Author: Jeroen Demeyer (jdemeyer) * Date: 2018-10-10 06:16
> Did you try with a minimal project containing a C extension?
> Did you install in a system where sys.prefix != sys.exec_prefix?

Yes to both questions.
History
Date User Action Args
2018-10-10 06:16:01jdemeyersetmessages: + msg327455
2018-10-09 15:02:05eric.araujosetmessages: + msg327416
2018-10-09 15:00:07jdemeyersetmessages: + msg327415
2018-10-09 14:45:21eric.araujosetmessages: + msg327413
2018-10-09 14:40:16jdemeyersetmessages: + msg327412
2018-10-09 14:24:44jdemeyersetmessages: + msg327408
2018-10-09 14:23:53jdemeyersetmessages: + msg327407
2018-10-09 14:10:19eric.araujosetmessages: + msg327403
2018-10-09 13:15:34jdemeyersetfiles: - data_files_doc.patch
2018-10-09 13:12:01jdemeyersetpull_requests: + pull_request9154
2016-05-28 23:58:02berker.peksagsetversions: + Python 3.5, Python 3.6
nosy: + berker.peksag, eric.araujo, dstufft

components: + Distutils
type: behavior
stage: patch review
2016-05-28 23:56:58berker.peksaglinkissue9363 superseder
2015-11-10 06:06:12jdemeyercreate