classification
Title: The coverage job is broken: distutils build_ext fails on None
Type: Stage: resolved
Components: Build, Tests Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: haypo Nosy List: brett.cannon, haypo, jkloth, pitrou
Priority: normal Keywords:

Created on 2017-05-04 20:51 by haypo, last changed 2017-06-26 09:58 by haypo. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1464 merged haypo, 2017-05-04 21:09
PR 1465 merged haypo, 2017-05-04 23:56
PR 1515 merged python-dev, 2017-05-09 12:42
PR 1625 merged haypo, 2017-05-17 00:25
PR 1626 merged haypo, 2017-05-17 00:26
Messages (20)
msg293014 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-04 20:51
Bug reported by Antoine Pitrou on the python-committers mailing list.

According to Brett Canon, the first failure was:
https://travis-ci.org/python/cpython/jobs/228409786

And the regression is related to my commit a5c62a8e9f0de6c4133825a5710984a3cd5e102b: bpo-23404.

Collecting coverage
  Downloading coverage-4.3.4.tar.gz (361kB)
�    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/coverage.egg-info
    writing pip-egg-info/coverage.egg-info/PKG-INFO
    writing dependency_links to
pip-egg-info/coverage.egg-info/dependency_links.txt
    writing entry points to pip-egg-info/coverage.egg-info/entry_points.txt
    writing top-level names to pip-egg-info/coverage.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/coverage.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ewtgqc2r/coverage/setup.py", line 204, in
<module>
        main()
      File "/tmp/pip-build-ewtgqc2r/coverage/setup.py", line 194, in main
        setup(**setup_args)
      File "/home/travis/build/python/cpython/Lib/distutils/core.py",
line 148, in setup
        dist.run_commands()
      File "/home/travis/build/python/cpython/Lib/distutils/dist.py",
line 955, in run_commands
        self.run_command(cmd)
      File "/home/travis/build/python/cpython/Lib/distutils/dist.py",
line 974, in run_command
        cmd_obj.run()
      File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 279, in run
        self.find_sources()
      File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 306, in find_sources
        mm.run()
      File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 533, in run
        self.add_defaults()
      File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 562, in add_defaults
        sdist.add_defaults(self)
      File
"/home/travis/build/python/cpython/Lib/distutils/command/sdist.py", line
228, in add_defaults
        self._add_defaults_ext()
      File
"/home/travis/build/python/cpython/Lib/distutils/command/sdist.py", line
311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/home/travis/build/python/cpython/Lib/distutils/cmd.py",
line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/home/travis/build/python/cpython/Lib/distutils/cmd.py",
line 107, in ensure_finalized
        self.finalize_options()
      File
"/home/travis/build/python/cpython/Lib/distutils/command/build_ext.py",
line 150, in finalize_options
        py_include = sysconfig.get_python_inc()
      File
"/home/travis/build/python/cpython/Lib/distutils/sysconfig.py", line
100, in get_python_inc
        incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR'))
      File "/home/travis/build/python/cpython/Lib/posixpath.py", line
92, in join
        genericpath._check_arg_types('join', a, *p)
      File "/home/travis/build/python/cpython/Lib/genericpath.py", line
149, in _check_arg_types
        (funcname, s.__class__.__name__)) from None
    TypeError: join() argument must be str or bytes, not 'NoneType'

    ----------------------------------------
�Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-ewtgqc2r/coverage/�
msg293015 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-04 20:55
To reproduce the bug, build the master branch of Python and then run:

./python -m venv venv
./venv/bin/python -m pip install -U coverage

Or just:

$ ./venv/bin/python -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/haypo/prog/python/master/Lib/distutils/sysconfig.py", line 100, in get_python_inc
    incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR'))
  File "/home/haypo/prog/python/master/Lib/posixpath.py", line 92, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/haypo/prog/python/master/Lib/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
msg293016 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-04 21:07
> get_config_var('AST_H_DIR')

Oh, I see. My commit a5c62a8e9f0de6c4133825a5710984a3cd5e102b removed multiple variables from Makefile.pre.in to simplify it, but I didn't notice that some of them (only AST_H_DIR?) were used outside Makefile.pre.in. I completely forgot the evil sysconfig (evil in term of backward compatibility...).

I removed the following variables from Makefile.pre.in:

* @GENERATED_COMMENT@
* ASDLGEN
* ASDLGEN_FILES
* AST_ASDL
* AST_C
* AST_C_DIR
* AST_H
* AST_H_DIR
* GRAMMAR_C
* GRAMMAR_H
* GRAMMAR_INPUT
* OPCODETARGETGEN
* OPCODETARGETGEN_FILES
* OPCODETARGETS_H
* OPCODE_H
* OPCODE_H_DIR
* OPCODE_H_GEN
* OPCODE_H_SCRIPT
* PYTHON_FOR_GEN (renamed to PYTHON_FOR_REGEN)

I didn't see the point of the AST_H_DIR variable since its value was hardcoded to "Include" and it was only used to regenerate generated files related to AST.

I don't understand why sysconfig chose this specific variable to get the "Include" subdirectory!?

I'm writing a fix to replace AST_H_DIR variable with "Include".
msg293017 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-04 21:29
New changeset b109a1d3360fc4bb87b9887264e3634632d392ca by Victor Stinner in branch 'master':
bpo-30273: Update sysconfig (#1464)
https://github.com/python/cpython/commit/b109a1d3360fc4bb87b9887264e3634632d392ca
msg293027 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-04 22:46
New changeset 9d02f562961efd12d3c8317a10916db7f77330cc by Victor Stinner in branch '3.6':
[3.6] bpo-23404: make touch becomes make regen-all (#1405) (#1461)
https://github.com/python/cpython/commit/9d02f562961efd12d3c8317a10916db7f77330cc
msg293028 - (view) Author: Jeremy Kloth (jkloth) * Date: 2017-05-04 22:55
The change to sysconfig *may* be a regression wrt bpo-15366.

I'm not in the position to be able to check this possibility, ATM, but it is possible that other things have also changed since this was commited 5 years ago.
msg293029 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-05 00:15
> The change to sysconfig *may* be a regression wrt bpo-15366.

Hum, I'm still able to create a venv and install coverage in the venv after my commit b109a1d3360fc4bb87b9887264e3634632d392ca, whereas this commit basically reverts the bpo-15366 fix.
msg293031 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-05 00:20
New changeset ab6b962ef241be97536573d7490ce1cfc74fde18 by Victor Stinner in branch '3.5':
bpo-23404: make touch becomes make regen-all (#1405) (#1461) (#1465)
https://github.com/python/cpython/commit/ab6b962ef241be97536573d7490ce1cfc74fde18
msg293035 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-05 01:28
Jeremy Kloth: "I'm not in the position to be able to check this possibility, ATM, but it is possible that other things have also changed since this was commited 5 years ago."

I expect that many bugs have been fixed in virtualenv and venv modules, so maybe bpo-15366 was fixed indirectly?

It would be nice if you can tests on your side, since I'm not confident in my own tests :-)

I modified the build system of Python 2.7, 3.5, 3.6 and master (3.7). So you can pick any of these branches to run your test :-) I'm not sure that the bug affected or can affect Python 2.7.
msg293300 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-09 11:22
The coverage job has been fixed and I'm unable to reproduce bpo-15366 bug (my change doesn't seem to have introduced a regression), so I close the issue.

I sent an email to python-dev to warn about this change, so maybe others will double check.

@Jeremy: please double check my change to make sure that I didn't introduce a regression.
msg293304 - (view) Author: Jeremy Kloth (jkloth) * Date: 2017-05-09 12:52
PR1515 addresses the issue from bpo-15366 (venv from Python compiled with builddir != srcdir).  It seems that the original fix from bpo-15366 no longer worked.  This addresses that.
msg293306 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-09 13:07
I reopen the issue since Jeremy posted a new PR.
msg293308 - (view) Author: Jeremy Kloth (jkloth) * Date: 2017-05-09 13:15
Yeah, sorry, I was working (fighting ;) with the new GitHub workflow while you updated the status.
msg293320 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-09 15:21
Ok, I reproduced the bug:

cd ~/prog/python/master
git clean -fdx

mkdir ~/build_cpython
cd ~/build_cpython/
~/prog/python/master/configure --with-pydebug --prefix=/home/haypo/prefix
make
./python -m venv ~/venv

cd ~/venv
. bin/activate
python -m pip install fat

=> error on missing Python.h
msg293321 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-09 15:24
New changeset dbdea629e2e0e4bd8845aa55041e0a0ca4172cf3 by Victor Stinner (Jeremy Kloth) in branch 'master':
bpo-30273: update distutils.sysconfig for venv's created from Python (#1515)
https://github.com/python/cpython/commit/dbdea629e2e0e4bd8845aa55041e0a0ca4172cf3
msg293832 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-17 00:58
New changeset 460945f22acd288e660b432b288d9d81655572bf by Victor Stinner in branch '3.6':
bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1625)
https://github.com/python/cpython/commit/460945f22acd288e660b432b288d9d81655572bf
msg293834 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-17 00:59
New changeset f01c0ec9fe571e8afd50d2f5180db3c0d7b613af by Victor Stinner in branch '3.5':
bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1626)
https://github.com/python/cpython/commit/f01c0ec9fe571e8afd50d2f5180db3c0d7b613af
msg294270 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2017-05-23 18:00
Can this be closed?
msg294283 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-23 20:35
Can someone please check if the job pass on all branches? If yes, please
close the issue.
msg296868 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-06-26 09:58
Me: "Can someone please check if the job pass on all branches? If yes, please close the issue."

Hum, I don't see the coverage job on my PR anymore. I don't know where it's gone. It seems like this issue is fixed, so I close it.
History
Date User Action Args
2017-06-26 09:58:56hayposetstatus: open -> closed
resolution: fixed
messages: + msg296868
2017-05-23 20:35:27hayposetmessages: + msg294283
2017-05-23 18:00:24brett.cannonsetnosy: + brett.cannon
messages: + msg294270
2017-05-17 00:59:26hayposetmessages: + msg293834
2017-05-17 00:58:04hayposetmessages: + msg293832
2017-05-17 00:26:07hayposetpull_requests: + pull_request1716
2017-05-17 00:25:28hayposetpull_requests: + pull_request1714
2017-05-09 15:24:15hayposetmessages: + msg293321
2017-05-09 15:21:29hayposetmessages: + msg293320
2017-05-09 13:15:53jklothsetmessages: + msg293308
2017-05-09 13:07:59hayposetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg293306
2017-05-09 12:52:50jklothsetmessages: + msg293304
2017-05-09 12:42:33python-devsetpull_requests: + pull_request1614
2017-05-09 11:22:11hayposetstatus: open -> closed
resolution: fixed
messages: + msg293300

stage: resolved
2017-05-08 22:19:07brett.cannonsetassignee: haypo
2017-05-05 01:28:20hayposetmessages: + msg293035
2017-05-05 00:20:03hayposetmessages: + msg293031
2017-05-05 00:15:39hayposetmessages: + msg293029
2017-05-04 23:56:57hayposetpull_requests: + pull_request1564
2017-05-04 22:55:12jklothsetnosy: + jkloth
messages: + msg293028
2017-05-04 22:46:59hayposetmessages: + msg293027
2017-05-04 21:29:11hayposetmessages: + msg293017
2017-05-04 21:09:00hayposetpull_requests: + pull_request1561
2017-05-04 21:07:53hayposetmessages: + msg293016
2017-05-04 20:55:16hayposetmessages: + msg293015
2017-05-04 20:51:05haypocreate