Skip to content

Commit 8a7a0e9

Browse files
committed
Issue #15819: Fix out-of-tree builds from a readonly source.
1 parent 5ebc5c3 commit 8a7a0e9

4 files changed

Lines changed: 62 additions & 4 deletions

File tree

Makefile.pre.in

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ INSTALL_DATA= @INSTALL_DATA@
5757
# Also, making them read-only seems to be a good idea...
5858
INSTALL_SHARED= ${INSTALL} -m 555
5959

60+
MKDIR_P= @MKDIR_P@
61+
6062
MAKESETUP= $(srcdir)/Modules/makesetup
6163

6264
# Compiler options
@@ -204,8 +206,8 @@ SIGNAL_OBJS= @SIGNAL_OBJS@
204206

205207
##########################################################################
206208
# Grammar
207-
GRAMMAR_H= $(srcdir)/Include/graminit.h
208-
GRAMMAR_C= $(srcdir)/Python/graminit.c
209+
GRAMMAR_H= Include/graminit.h
210+
GRAMMAR_C= Python/graminit.c
209211
GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
210212

211213

@@ -246,9 +248,9 @@ PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
246248

247249
##########################################################################
248250
# AST
249-
AST_H_DIR= $(srcdir)/Include
251+
AST_H_DIR= Include
250252
AST_H= $(AST_H_DIR)/Python-ast.h
251-
AST_C_DIR= $(srcdir)/Python
253+
AST_C_DIR= Python
252254
AST_C= $(AST_C_DIR)/Python-ast.c
253255
AST_ASDL= $(srcdir)/Parser/Python.asdl
254256

@@ -563,9 +565,11 @@ Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
563565
Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
564566

565567
$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
568+
$(MKDIR_P) $(AST_H_DIR)
566569
$(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
567570

568571
$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
572+
$(MKDIR_P) $(AST_C_DIR)
569573
$(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
570574

571575
Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ Tests
364364
Build
365365
-----
366366

367+
- Issue #15819: Make sure we can build Python out-of-tree from a readonly
368+
source directory. (Somewhat related to Issue #9860.)
369+
367370
- Issue #15645: Ensure 2to3 grammar pickles are properly installed.
368371

369372
- Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.

configure

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ UNIVERSAL_ARCH_FLAGS
640640
BASECFLAGS
641641
OPT
642642
LN
643+
MKDIR_P
643644
INSTALL_DATA
644645
INSTALL_SCRIPT
645646
INSTALL_PROGRAM
@@ -5356,6 +5357,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
53565357
53575358
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
53585359
5360+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
5361+
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
5362+
if test -z "$MKDIR_P"; then
5363+
if ${ac_cv_path_mkdir+:} false; then :
5364+
$as_echo_n "(cached) " >&6
5365+
else
5366+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5367+
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
5368+
do
5369+
IFS=$as_save_IFS
5370+
test -z "$as_dir" && as_dir=.
5371+
for ac_prog in mkdir gmkdir; do
5372+
for ac_exec_ext in '' $ac_executable_extensions; do
5373+
{ test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
5374+
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
5375+
'mkdir (GNU coreutils) '* | \
5376+
'mkdir (coreutils) '* | \
5377+
'mkdir (fileutils) '4.1*)
5378+
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
5379+
break 3;;
5380+
esac
5381+
done
5382+
done
5383+
done
5384+
IFS=$as_save_IFS
5385+
5386+
fi
5387+
5388+
test -d ./--version && rmdir ./--version
5389+
if test "${ac_cv_path_mkdir+set}" = set; then
5390+
MKDIR_P="$ac_cv_path_mkdir -p"
5391+
else
5392+
# As a last resort, use the slow shell script. Don't cache a
5393+
# value for MKDIR_P within a source directory, because that will
5394+
# break other packages using the cache if that directory is
5395+
# removed, or if the value is a relative name.
5396+
MKDIR_P="$ac_install_sh -d"
5397+
fi
5398+
fi
5399+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
5400+
$as_echo "$MKDIR_P" >&6; }
5401+
53595402
53605403
# Not every filesystem supports hard links
53615404
@@ -14479,6 +14522,7 @@ gives unlimited permission to copy, distribute and modify it."
1447914522
ac_pwd='$ac_pwd'
1448014523
srcdir='$srcdir'
1448114524
INSTALL='$INSTALL'
14525+
MKDIR_P='$MKDIR_P'
1448214526
test -n "\$AWK" || AWK=awk
1448314527
_ACEOF
1448414528
@@ -15047,6 +15091,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
1504715091
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
1504815092
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
1504915093
esac
15094+
ac_MKDIR_P=$MKDIR_P
15095+
case $MKDIR_P in
15096+
[\\/$]* | ?:[\\/]* ) ;;
15097+
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
15098+
esac
1505015099
_ACEOF
1505115100
1505215101
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -15101,6 +15150,7 @@ s&@builddir@&$ac_builddir&;t t
1510115150
s&@abs_builddir@&$ac_abs_builddir&;t t
1510215151
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
1510315152
s&@INSTALL@&$ac_INSTALL&;t t
15153+
s&@MKDIR_P@&$ac_MKDIR_P&;t t
1510415154
$ac_datarootdir_hack
1510515155
"
1510615156
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ bsdos*|hp*|HP*)
878878
fi
879879
esac
880880
AC_PROG_INSTALL
881+
AC_PROG_MKDIR_P
881882

882883
# Not every filesystem supports hard links
883884
AC_SUBST(LN)

0 commit comments

Comments
 (0)