Skip to content

Commit 961d54c

Browse files
authored
bpo-32430: Rename Modules/Setup.dist to Modules/Setup (GH-8229)
bpo-32430: Rename Modules/Setup.dist to Modules/Setup Remove the necessity to copy the former manually to the latter when updating the local source tree.
1 parent 35c0809 commit 961d54c

File tree

11 files changed

+32
-43
lines changed

11 files changed

+32
-43
lines changed

Doc/whatsnew/3.8.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ Build and C API Changes
139139
``const char *`` rather of ``char *``.
140140
(Contributed by Serhiy Storchaka in :issue:`33818`.)
141141

142+
* The duality of ``Modules/Setup.dist`` and ``Modules/Setup`` has been
143+
removed. Previously, when updating the CPython source tree, one had
144+
to manually copy ``Modules/Setup.dist`` (inside the source tree) to
145+
``Modules/Setup`` (inside the build tree) in order to reflect any changes
146+
upstream. This was of a small benefit to packagers at the expense of
147+
a frequent annoyance to developers following CPython development, as
148+
forgetting to copy the file could produce build failures.
149+
150+
Now the build system always reads from ``Modules/Setup`` inside the source
151+
tree. People who want to customize that file are encouraged to maintain
152+
their changes in a git fork of CPython or as patch files, as they would do
153+
for any other change to the source tree.
154+
155+
(Contributed by Antoine Pitrou in :issue:`32430`.)
156+
142157

143158
Deprecated
144159
==========

Lib/distutils/sysconfig.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
# python_build: (Boolean) if true, we're either building Python or
3737
# building an extension with an un-installed Python, so we use
3838
# different (hard-wired) directories.
39-
# Setup.local is available for Makefile builds including VPATH builds,
40-
# Setup.dist is available on Windows
4139
def _is_python_source_dir(d):
42-
for fn in ("Setup.dist", "Setup.local"):
40+
for fn in ("Setup", "Setup.local"):
4341
if os.path.isfile(os.path.join(d, "Modules", fn)):
4442
return True
4543
return False

Lib/sysconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _safe_realpath(path):
119119
_PROJECT_BASE = _safe_realpath(os.environ["_PYTHON_PROJECT_BASE"])
120120

121121
def _is_python_source_dir(d):
122-
for fn in ("Setup.dist", "Setup.local"):
122+
for fn in ("Setup", "Setup.local"):
123123
if os.path.isfile(os.path.join(d, "Modules", fn)):
124124
return True
125125
return False

Makefile.pre.in

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -687,26 +687,16 @@ oldsharedmods: $(SHAREDMODS)
687687
Makefile Modules/config.c: Makefile.pre \
688688
$(srcdir)/Modules/config.c.in \
689689
$(MAKESETUP) \
690-
Modules/Setup \
690+
$(srcdir)/Modules/Setup \
691691
Modules/Setup.local
692692
$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
693693
-s Modules \
694694
Modules/Setup.local \
695-
Modules/Setup
695+
$(srcdir)/Modules/Setup
696696
@mv config.c Modules
697697
@echo "The Makefile was updated, you may need to re-run make."
698698

699699

700-
Modules/Setup: $(srcdir)/Modules/Setup.dist
701-
@if test -f Modules/Setup; then \
702-
echo "-----------------------------------------------"; \
703-
echo "Modules/Setup.dist is newer than Modules/Setup;"; \
704-
echo "check to make sure you have all the updates you"; \
705-
echo "need in your Modules/Setup file."; \
706-
echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
707-
echo "-----------------------------------------------"; \
708-
fi
709-
710700
Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
711701
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
712702

@@ -1478,7 +1468,7 @@ libainstall: @DEF_MAKE_RULE@ python-config
14781468
$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
14791469
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
14801470
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1481-
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1471+
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
14821472
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
14831473
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
14841474
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
@@ -1701,8 +1691,7 @@ distclean: clobber
17011691
for file in $(srcdir)/Lib/test/data/* ; do \
17021692
if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \
17031693
done
1704-
-rm -f core Makefile Makefile.pre config.status \
1705-
Modules/Setup Modules/Setup.local \
1694+
-rm -f core Makefile Makefile.pre config.status Modules/Setup.local \
17061695
Modules/ld_so_aix Modules/python.exp Misc/python.pc \
17071696
Misc/python-config.sh
17081697
-rm -f python*-gdb.py
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Rename Modules/Setup.dist to Modules/Setup, and remove the necessity to copy
2+
the former manually to the latter when updating the local source tree.

Modules/Setup.dist renamed to Modules/Setup

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# -*- makefile -*-
22
# The file Setup is used by the makesetup script to construct the files
33
# Makefile and config.c, from Makefile.pre and config.c.in,
4-
# respectively. The file Setup itself is initially copied from
5-
# Setup.dist; once it exists it will not be overwritten, so you can edit
6-
# Setup to your heart's content. Note that Makefile.pre is created
7-
# from Makefile.pre.in by the toplevel configure script.
4+
# respectively. Note that Makefile.pre is created from Makefile.pre.in
5+
# by the toplevel configure script.
86

97
# (VPATH notes: Setup and Makefile.pre are in the build directory, as
10-
# are Makefile and config.c; the *.in and *.dist files are in the source
11-
# directory.)
8+
# are Makefile and config.c; the *.in files are in the source directory.)
129

1310
# Each line in this file describes one or more optional modules.
1411
# Modules configured here will not be compiled by the setup.py script,

Modules/getpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
322322
/* Check to see if argv[0] is in the build directory */
323323
wcsncpy(prefix, calculate->argv0_path, MAXPATHLEN);
324324
prefix[MAXPATHLEN] = L'\0';
325-
joinpath(prefix, L"Modules/Setup");
325+
joinpath(prefix, L"Modules/Setup.local");
326326
if (isfile(prefix)) {
327327
/* Check VPATH to see if argv0_path is in the build directory. */
328328
vpath = Py_DecodeLocale(VPATH, NULL);

Modules/makesetup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Setup files after a -n option are used for their variables, modules
1818
# and libraries but not for their .o files.
1919
#
20-
# See Setup.dist for a description of the format of the Setup file.
20+
# See Setup for a description of the format of the Setup file.
2121
#
2222
# The following edits are made:
2323
#

aclocal.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
1+
# generated automatically by aclocal 1.15 -*- Autoconf -*-
22

3-
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
3+
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
44

55
# This file is free software; the Free Software Foundation
66
# gives unlimited permission to copy and/or distribute it,

configure

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18339,12 +18339,6 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
1833918339
fi
1834018340
1834118341
18342-
echo "creating Modules/Setup" >&6
18343-
if test ! -f Modules/Setup
18344-
then
18345-
cp $srcdir/Modules/Setup.dist Modules/Setup
18346-
fi
18347-
1834818342
echo "creating Modules/Setup.local" >&6
1834918343
if test ! -f Modules/Setup.local
1835018344
then
@@ -18354,7 +18348,7 @@ fi
1835418348
echo "creating Makefile" >&6
1835518349
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1835618350
-s Modules \
18357-
Modules/Setup.local Modules/Setup
18351+
Modules/Setup.local $srcdir/Modules/Setup
1835818352
mv config.c Modules
1835918353
1836018354
if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then

configure.ac

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5547,12 +5547,6 @@ AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-config.sh)
55475547
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
55485548
AC_OUTPUT
55495549

5550-
echo "creating Modules/Setup" >&AS_MESSAGE_FD
5551-
if test ! -f Modules/Setup
5552-
then
5553-
cp $srcdir/Modules/Setup.dist Modules/Setup
5554-
fi
5555-
55565550
echo "creating Modules/Setup.local" >&AS_MESSAGE_FD
55575551
if test ! -f Modules/Setup.local
55585552
then
@@ -5562,7 +5556,7 @@ fi
55625556
echo "creating Makefile" >&AS_MESSAGE_FD
55635557
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
55645558
-s Modules \
5565-
Modules/Setup.local Modules/Setup
5559+
Modules/Setup.local $srcdir/Modules/Setup
55665560
mv config.c Modules
55675561

55685562
if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then

0 commit comments

Comments
 (0)