classification
Title: 'make touch' does not work with git clones of the source repository
Type: enhancement Stage: needs patch
Components: Build Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Chi Hsuan Yen, berker.peksag, brett.cannon, ezio.melotti, josh.r, martin.panter, ned.deily, python-dev, vlee, willingc, zach.ware
Priority: critical Keywords: buildbot, patch

Created on 2015-02-06 22:46 by vlee, last changed 2017-02-11 00:38 by zach.ware.

Files
File name Uploaded Description Edit
0001-Issue-23404-Do-not-use-Python-2.7-constructs-in-Pars.patch vlee, 2015-02-07 06:17 Do not use Python 2.7 constructs in Parser/asdl.py.
iss23404devguide.patch willingc, 2015-07-28 09:17
boot-flag.patch martin.panter, 2016-09-13 11:29 review
boot-flag.patch Chi Hsuan Yen, 2017-02-10 09:25 Based on Martin's version, with a minor fix review
Messages (16)
msg235505 - (view) Author: Vinson Lee (vlee) * Date: 2015-02-06 22:46
Is there a minimum Python requirement to build Python?

Python 3.5 does not build with Python 2.6. Python 3.4, Python 3.3, and Python 2.7 build with Python 2.6 so this is recent change in build requirements.

For example, this build failure occurs on CentOS 6.

python ./Parser/asdl_c.py -h Include ./Parser/Python.asdl
Traceback (most recent call last):
  File "./Parser/asdl_c.py", line 6, in <module>
    import asdl
  File "Parser/asdl.py", line 36
    builtin_types = {'identifier', 'string', 'bytes', 'int', 'object', 'singleton'}
                                 ^
SyntaxError: invalid syntax
msg235508 - (view) Author: Josh Rosenberg (josh.r) * Date: 2015-02-07 02:44
Looks like this revision, part of #22823, changed it: https://hg.python.org/cpython/rev/4480506137ed
msg235509 - (view) Author: Josh Rosenberg (josh.r) * Date: 2015-02-07 02:51
To answer your question: Since asdl uses set literals (introduced in 2.7 and 3.0), that appears to put an effective minimum version requirement of 2.7 to build 3.5. Whether that was the intent is unclear (they were changing a lot of places from set([a, b, c]) to {a, b, c}; causing problems building Python was probably not the intent, but 2.6 is well out of support at this point).
msg235510 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-02-07 03:21
Try using "make touch" before "make".  Because hg does not preserve precise time stamps when creating working directories, some build steps are run unnecessarily after an initial checkout.  'make touch' updates the file time stamps so that these steps are skipped and a "bootstrap" Python is not needed.
msg235511 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-02-07 03:23
https://docs.python.org/devguide/setup.html#avoiding-re-creating-auto-generated-files
msg235513 - (view) Author: Vinson Lee (vlee) * Date: 2015-02-07 06:17
I am building from a git copy of the source repository. "make touch" before "make" does not work for me.

$ make touch
cd .; \
	hg --config extensions.touch=Tools/hg/hgtouch.py touch -v
abort: There is no Mercurial repository here (.hg not found)!

I've attached a patch that addresses the Python 3.5 build issue for me. The patch contains two syntax construct changes to Parser/asdl.py. Please consider applying this patch upstream.
msg235514 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-02-07 06:34
Unfortunately, those syntax differences aren't the only problems you could run into so making these syntax changes isn't really a general solution, IMO. 'make touch' is the documented and supported way to ensure that the unnecessary build steps are not run.  But, as you discovered, 'make touch' only works with an hg copy of the repo; it was not designed for git clones.  To fully support git clones, there would need to be a git equivalent of the hg scripts called by 'make touch'.  This would be a worthwhile project for someone interested in git support to work on and would be considered for inclusion in the repo.
msg235515 - (view) Author: Vinson Lee (vlee) * Date: 2015-02-07 06:52
With the supplied patch on CentOS 6 , "make" passes and "make test" passes with the exception of test_readline that is Issue19884.

372 tests OK.
1 test failed:
    test_readline
7 tests altered the execution environment:
    test_calendar test_distutils test_float test_locale test_strptime
    test_types test_warnings
11 tests skipped:
    test_devpoll test_gdb test_kqueue test_msilib test_ossaudiodev
    test_startfile test_tk test_ttk_guionly test_winreg test_winsound
    test_zipfile64
Re-running failed tests in verbose mode
Re-running test 'test_readline' in verbose mode
testHistoryUpdates (test.test_readline.TestHistoryManipulation) ... ok
test_write_read_append (test.test_readline.TestHistoryManipulation) ... ok
test_init (test.test_readline.TestReadline) ... FAIL
msg235516 - (view) Author: Vinson Lee (vlee) * Date: 2015-02-07 07:08
I tried a hg copy of the repository. "make touch" worked for me.

./configure
make touch
make
msg247510 - (view) Author: Carol Willing (willingc) * Date: 2015-07-28 09:17
Using Ned Deily's feedback, I have added a devguide patch to clarify that 'make touch' only works with a Mercurial clone and was not designed for git clones. This patch, iss23404devguide.patch, resolves the devguide portion of this issue unless anyone has further wording changes.
msg247574 - (view) Author: Roundup Robot (python-dev) Date: 2015-07-29 13:58
New changeset ffbb19026599 by Berker Peksag in branch 'default':
Issue #23404: Add a note to clarify that "make touch" only works with a hg clone.
https://hg.python.org/devguide/rev/ffbb19026599
msg247575 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-07-29 14:07
Patch LGTM. Thanks Carol.

I will left this issue open in case someone wants to work on a git equivalent of "make touch" as described by Ned in msg235514.
msg275285 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-09 08:09
Perhaps you can use “make -t <file>” instead of “make touch”. If you know the filename you want to avoid regenerating, that would not need any extra tools, no Mercurial or Git or any other version control. E.g.:

make -t Include/Python-ast.h
msg276252 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-13 11:29
Okay so my “make -t” trick has various flaws. You still have to know the filenames to specify, it requires Makefile to be generated by configure in the source tree, and it creates empty files if you use it in a separate build directory.

Another idea: instead of the “make touch” recipe, we add a simple shell script. Call it say “touch-bootstrap.sh”. Like what “make touch” already does in Python 2, but without embedding it as a makefile rule.

Or add a flag variable so you can do a build without running any of the regeneration rules or worrying about timestamps: make BOOT="#".
msg287493 - (view) Author: Chi Hsuan Yen (Chi Hsuan Yen) * Date: 2017-02-10 09:25
Just tried boot-flag.patch with https://github.com/python/cpython/commit/16e07881bd3867d471dd0a25c5117672b65c90ee. Doesn't work out-of-box:

#./Programs/_freeze_importlib \
    ./Lib/importlib/_bootstrap.py Python/importlib.h
/bin/sh: line 1: ./Lib/importlib/_bootstrap.py: Permission denied
make: *** [Makefile:749: Python/importlib.h] Error 126

My fix is: merge the two lines into a single one. See my attached patch.

By the way, the BOOT hack is quite similar to GENERATED_COMMENT in introduced in issue27641. Maybe they can merge?

My environment:

* Arch Linux x86_64
* /bin/sh symlinks to bash, which is 4.4.12
* GNU Make 4.2.1
msg287580 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2017-02-11 00:38
I've disabled the Touch step on the buildbots until this is fixed.
History
Date User Action Args
2017-02-11 00:38:13zach.waresetpriority: normal -> critical
versions: + Python 2.7, Python 3.7
nosy: + zach.ware

messages: + msg287580

keywords: + buildbot
2017-02-10 09:25:37Chi Hsuan Yensetfiles: + boot-flag.patch
nosy: + Chi Hsuan Yen
messages: + msg287493

2016-09-13 11:29:24martin.pantersetfiles: + boot-flag.patch

messages: + msg276252
2016-09-09 08:09:10martin.pantersetnosy: + martin.panter
messages: + msg275285
2016-01-02 00:17:29ezio.melottisetnosy: + brett.cannon
2015-07-29 14:07:11berker.peksagsettype: enhancement
components: - Devguide
versions: + Python 3.6
nosy: + berker.peksag

messages: + msg247575
stage: patch review -> needs patch
2015-07-29 13:58:19python-devsetnosy: + python-dev
messages: + msg247574
2015-07-28 09:17:26willingcsetfiles: + iss23404devguide.patch

nosy: + willingc
messages: + msg247510

stage: needs patch -> patch review
2015-02-07 07:08:18vleesetmessages: + msg235516
2015-02-07 06:52:52vleesetmessages: + msg235515
2015-02-07 06:34:43ned.deilysettype: compile error -> (no value)
components: + Devguide
title: Python 3.5 does not build with Python 2.6. -> 'make touch' does not work with git clones of the source repository
nosy: + ezio.melotti

messages: + msg235514
resolution: not a bug ->
stage: resolved -> needs patch
2015-02-07 06:17:20vleesetstatus: closed -> open
files: + 0001-Issue-23404-Do-not-use-Python-2.7-constructs-in-Pars.patch
messages: + msg235513

keywords: + patch
2015-02-07 03:25:15ned.deilysetstatus: open -> closed
resolution: not a bug
stage: resolved
2015-02-07 03:23:14ned.deilysetmessages: + msg235511
2015-02-07 03:21:27ned.deilysetnosy: + ned.deily
messages: + msg235510
2015-02-07 02:51:31josh.rsetmessages: + msg235509
2015-02-07 02:44:56josh.rsetnosy: + josh.r
messages: + msg235508
2015-02-06 22:46:05vleecreate