Never create pyc files on filesystem
This commit is contained in:
parent
1665723b70
commit
67acb607f6
|
@ -0,0 +1,26 @@
|
|||
SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: Python-2.0.1
|
||||
|
||||
Disable creation of pyc files.
|
||||
|
||||
--- Lib/py_compile.py 2024-01-22 11:28:00.291261389 +1100
|
||||
+++ Lib/py_compile.py 2024-01-22 11:28:13.462600939 +1100
|
||||
@@ -41,6 +41,7 @@
|
||||
directories).
|
||||
|
||||
"""
|
||||
+ return
|
||||
import os, marshal, __builtin__
|
||||
f = open(file)
|
||||
try:
|
||||
--- Python/import.c 2024-01-22 12:23:34.349395727 +1100
|
||||
+++ Python/import.c 2024-01-22 12:23:30.299285640 +1100
|
||||
@@ -672,6 +672,7 @@
|
||||
static void
|
||||
write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
|
||||
{
|
||||
+ return;
|
||||
FILE *fp;
|
||||
|
||||
fp = open_exclusive(cpathname);
|
|
@ -0,0 +1,25 @@
|
|||
SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: PSF-2.0
|
||||
|
||||
Disable creation of pyc files.
|
||||
--- Lib/py_compile.py 2024-01-22 11:28:44.333395804 +1100
|
||||
+++ Lib/py_compile.py 2024-01-22 11:28:53.703636809 +1100
|
||||
@@ -112,6 +112,7 @@
|
||||
directories).
|
||||
|
||||
"""
|
||||
+ return
|
||||
f = open(file, 'U')
|
||||
try:
|
||||
timestamp = long(os.fstat(f.fileno()).st_mtime)
|
||||
--- Python/import.c 2024-01-22 12:24:05.300236204 +1100
|
||||
+++ Python/import.c 2024-01-22 12:24:36.513082356 +1100
|
||||
@@ -807,6 +807,7 @@
|
||||
static void
|
||||
write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
|
||||
{
|
||||
+ return;
|
||||
FILE *fp;
|
||||
|
||||
fp = open_exclusive(cpathname);
|
|
@ -0,0 +1,26 @@
|
|||
SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: PSF-2.0
|
||||
|
||||
Disable creation of pyc files.
|
||||
|
||||
--- Lib/py_compile.py 2024-01-22 11:28:44.333395804 +1100
|
||||
+++ Lib/py_compile.py 2024-01-22 11:28:53.703636809 +1100
|
||||
@@ -112,6 +112,7 @@
|
||||
directories).
|
||||
|
||||
"""
|
||||
+ return
|
||||
f = open(file, 'U')
|
||||
try:
|
||||
timestamp = long(os.fstat(f.fileno()).st_mtime)
|
||||
--- Python/import.c 2024-01-22 12:24:59.390701654 +1100
|
||||
+++ Python/import.c 2024-01-22 12:25:18.643222249 +1100
|
||||
@@ -869,6 +869,7 @@
|
||||
static void
|
||||
write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
|
||||
{
|
||||
+ return;
|
||||
FILE *fp;
|
||||
|
||||
fp = open_exclusive(cpathname);
|
|
@ -20,7 +20,7 @@ src_prepare() {
|
|||
mkdir Tools/unicode/in Tools/unicode/out
|
||||
mv ../CP437.TXT Tools/unicode/in/
|
||||
pushd Tools/unicode
|
||||
python gencodec.py in/ ../../Lib/encodings/
|
||||
python -B gencodec.py in/ ../../Lib/encodings/
|
||||
popd
|
||||
|
||||
# Regenerate unicode
|
||||
|
@ -29,7 +29,7 @@ src_prepare() {
|
|||
mv "../${f}-3.2.0.txt" .
|
||||
mv "../${f}-5.1.0.txt" "${f}.txt"
|
||||
done
|
||||
python Tools/unicode/makeunicodedata.py
|
||||
python -B Tools/unicode/makeunicodedata.py
|
||||
|
||||
# Regenerate sre_constants.h
|
||||
rm Modules/sre_constants.h
|
||||
|
@ -57,22 +57,22 @@ src_compile() {
|
|||
# Temporarily break include cycle
|
||||
patch -Np0 -i graminit-regen.patch
|
||||
# Build pgen
|
||||
make "${MAKEJOBS}" Parser/pgen
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Parser/pgen
|
||||
# Regen graminit.c and graminit.h
|
||||
make "${MAKEJOBS}" Include/graminit.h
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Include/graminit.h
|
||||
|
||||
# Regenerate some Python scripts using the other regenerated files
|
||||
# Must move them out to avoid using Lib/ module files which are
|
||||
# incompatible with running version of Python
|
||||
cp Lib/{symbol,keyword,token}.py .
|
||||
python symbol.py
|
||||
python keyword.py
|
||||
python token.py
|
||||
python -B symbol.py
|
||||
python -B keyword.py
|
||||
python -B token.py
|
||||
|
||||
# Undo change
|
||||
patch -Np0 -R -i graminit-regen.patch
|
||||
# Now build the main program
|
||||
make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
|
@ -11,7 +11,7 @@ src_prepare() {
|
|||
|
||||
# Regenerate ssl_data for ssl module
|
||||
rm Modules/_ssl_data_300.h Modules/_ssl_data.h
|
||||
python Tools/ssl/make_ssl_data.py ../openssl-1.1.1l Modules/_ssl_data_111.h
|
||||
python -B Tools/ssl/make_ssl_data.py ../openssl-1.1.1l Modules/_ssl_data_111.h
|
||||
sed -i 's#$(srcdir)/Modules/_ssl_data.h ##' Makefile.pre.in
|
||||
sed -i 's#$(srcdir)/Modules/_ssl_data_300.h ##' Makefile.pre.in
|
||||
|
||||
|
@ -20,27 +20,27 @@ src_prepare() {
|
|||
mkdir Tools/unicode/in Tools/unicode/out
|
||||
mv ../CP437.TXT Tools/unicode/in/
|
||||
pushd Tools/unicode
|
||||
python gencodec.py in/ ../../Lib/encodings/
|
||||
python -B gencodec.py in/ ../../Lib/encodings/
|
||||
popd
|
||||
|
||||
# Regenerate stringprep
|
||||
rm Lib/stringprep.py
|
||||
mv ../rfc3454.txt .
|
||||
python Tools/unicode/mkstringprep.py > Lib/stringprep.py
|
||||
python -B Tools/unicode/mkstringprep.py > Lib/stringprep.py
|
||||
|
||||
# Regenerate unicode
|
||||
rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
|
||||
mkdir -p Tools/unicode/data
|
||||
mv ../*.txt ../*.zip Tools/unicode/data/
|
||||
python Tools/unicode/makeunicodedata.py
|
||||
python -B Tools/unicode/makeunicodedata.py
|
||||
|
||||
# Regenerate Lib/re/_casefix.py
|
||||
rm Lib/re/_casefix.py
|
||||
python Tools/scripts/generate_re_casefix.py Lib/re/_casefix.py
|
||||
python -B Tools/scripts/generate_re_casefix.py Lib/re/_casefix.py
|
||||
|
||||
# Regenerate Programs/test_frozenmain.h
|
||||
rm Programs/test_frozenmain.h
|
||||
python Programs/freeze_test_frozenmain.py Programs/test_frozenmain.h
|
||||
python -B Programs/freeze_test_frozenmain.py Programs/test_frozenmain.h
|
||||
|
||||
# Create dummy Python/stdlib_module_names.h
|
||||
echo 'static const char* _Py_stdlib_module_names[] = {};' > Python/stdlib_module_names.h
|
||||
|
@ -69,7 +69,9 @@ src_compile() {
|
|||
# We have to choose the order ourselves because the Makefile is extremely lax about the order
|
||||
# First of all, do everything that doesn't use any C
|
||||
rm Modules/_blake2/blake2s_impl.c
|
||||
make "${MAKEJOBS}" regen-opcode \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
make "${MAKEJOBS}" \
|
||||
regen-opcode \
|
||||
regen-opcode-targets \
|
||||
regen-typeslots \
|
||||
regen-token \
|
||||
|
@ -82,17 +84,17 @@ src_compile() {
|
|||
regen-global-objects
|
||||
|
||||
# Do the freeze regen process
|
||||
make "${MAKEJOBS}" regen-frozen
|
||||
make "${MAKEJOBS}" regen-deepfreeze
|
||||
make "${MAKEJOBS}" regen-global-objects
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-frozen
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-deepfreeze
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-global-objects
|
||||
|
||||
make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
|
||||
|
||||
# Regen Python/stdlib_module_names.h (you must have an existing build first)
|
||||
make "${MAKEJOBS}" regen-stdlib-module-names
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-stdlib-module-names
|
||||
|
||||
# Now rebuild with proper stdlib_module_names.h
|
||||
make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
|
@ -21,21 +21,21 @@ src_prepare() {
|
|||
mkdir Tools/unicode/in Tools/unicode/out
|
||||
mv ../CP437.TXT Tools/unicode/in/
|
||||
pushd Tools/unicode
|
||||
python gencodec.py in/ ../../Lib/encodings/
|
||||
python -B gencodec.py in/ ../../Lib/encodings/
|
||||
popd
|
||||
|
||||
# Regenerate unicode
|
||||
rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
|
||||
mv ../*.txt ../*.zip .
|
||||
python Tools/unicode/makeunicodedata.py
|
||||
python -B Tools/unicode/makeunicodedata.py
|
||||
|
||||
# Regenerate sre_constants.h
|
||||
rm Modules/sre_constants.h
|
||||
cp Lib/sre_constants.py .
|
||||
python sre_constants.py
|
||||
python -B sre_constants.py
|
||||
|
||||
# Regenerate _ssl_data.h
|
||||
python Tools/ssl/make_ssl_data.py /usr/include/openssl Modules/_ssl_data.h
|
||||
python -B Tools/ssl/make_ssl_data.py /usr/include/openssl Modules/_ssl_data.h
|
||||
|
||||
# Regenerate autoconf
|
||||
autoreconf-2.71 -fi
|
||||
|
@ -55,21 +55,21 @@ src_configure() {
|
|||
|
||||
src_compile() {
|
||||
# Build pgen
|
||||
make "${MAKEJOBS}" Parser/pgen
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Parser/pgen
|
||||
# Regen graminit.c and graminit.h
|
||||
make "${MAKEJOBS}" Include/graminit.h
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Include/graminit.h
|
||||
|
||||
# Regenerate some Python scripts using the other regenerated files
|
||||
# Must move them out to avoid using Lib/ module files which are
|
||||
# incompatible with running version of Python
|
||||
cp Lib/{symbol,keyword,token}.py .
|
||||
cp token.py _token.py
|
||||
python symbol.py
|
||||
python keyword.py
|
||||
python token.py
|
||||
python -B symbol.py
|
||||
python -B keyword.py
|
||||
python -B token.py
|
||||
|
||||
# Now build the main program
|
||||
make -j1 CFLAGS="-U__DATE__ -U__TIME__"
|
||||
PYTHONDONTWRITEBYTECODE=1 make -j1 CFLAGS="-U__DATE__ -U__TIME__"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
|
@ -21,23 +21,23 @@ src_prepare() {
|
|||
mkdir Tools/unicode/in Tools/unicode/out
|
||||
mv ../CP437.TXT Tools/unicode/in/
|
||||
pushd Tools/unicode
|
||||
python gencodec.py in/ ../../Lib/encodings/
|
||||
python -B gencodec.py in/ ../../Lib/encodings/
|
||||
popd
|
||||
|
||||
# Regenerate clinic
|
||||
find . -name "*.c" -or -name "*.h" | \
|
||||
xargs grep 'clinic input' -l | \
|
||||
xargs -L 1 python Tools/clinic/clinic.py
|
||||
xargs -L 1 python -B Tools/clinic/clinic.py
|
||||
|
||||
# Regenerate unicode
|
||||
rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
|
||||
mv ../*.txt ../*.zip .
|
||||
python Tools/unicode/makeunicodedata.py
|
||||
python -B Tools/unicode/makeunicodedata.py
|
||||
|
||||
# Regenerate sre_constants.h
|
||||
rm Modules/sre_constants.h
|
||||
cp Lib/sre_constants.py .
|
||||
python sre_constants.py
|
||||
python -B sre_constants.py
|
||||
mv sre_constants.h Modules/
|
||||
|
||||
# Regenerate autoconf
|
||||
|
@ -58,21 +58,21 @@ src_configure() {
|
|||
|
||||
src_compile() {
|
||||
# Build pgen
|
||||
make -j1 Parser/pgen
|
||||
PYTHONDONTWRITEBYTECODE=1 make -j1 Parser/pgen
|
||||
# Regen graminit.c and graminit.h
|
||||
make -j1 Include/graminit.h
|
||||
PYTHONDONTWRITEBYTECODE=1 make -j1 Include/graminit.h
|
||||
|
||||
# Regenerate some Python scripts using the other regenerated files
|
||||
# Must move them out to avoid using Lib/ module files which are
|
||||
# incompatible with running version of Python
|
||||
cp Lib/{symbol,keyword,token}.py .
|
||||
cp token.py _token.py
|
||||
python symbol.py
|
||||
python keyword.py
|
||||
python token.py
|
||||
python -B symbol.py
|
||||
python -B keyword.py
|
||||
python -B token.py
|
||||
|
||||
# Now build the main program
|
||||
make -j1 CFLAGS="-U__DATE__ -U__TIME__"
|
||||
PYTHONDONTWRITEBYTECODE=1 make -j1 CFLAGS="-U__DATE__ -U__TIME__"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
|
@ -15,24 +15,24 @@ src_prepare() {
|
|||
mkdir Tools/unicode/in Tools/unicode/out
|
||||
mv ../CP437.TXT Tools/unicode/in/
|
||||
pushd Tools/unicode
|
||||
python gencodec.py in/ ../../Lib/encodings/
|
||||
python -B gencodec.py in/ ../../Lib/encodings/
|
||||
popd
|
||||
|
||||
# Regenerate unicode
|
||||
rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
|
||||
mv ../*.txt ../*.zip .
|
||||
python Tools/unicode/makeunicodedata.py
|
||||
python -B Tools/unicode/makeunicodedata.py
|
||||
|
||||
# Regenerate sre_constants.h
|
||||
rm Modules/sre_constants.h
|
||||
cp Lib/sre_constants.py .
|
||||
python sre_constants.py
|
||||
python -B sre_constants.py
|
||||
rm sre_constants.py
|
||||
mv sre_constants.h Modules/
|
||||
|
||||
# Regenerate stringprep
|
||||
rm Lib/stringprep.py
|
||||
python Tools/unicode/mkstringprep.py > Lib/stringprep.py
|
||||
python -B Tools/unicode/mkstringprep.py > Lib/stringprep.py
|
||||
|
||||
# Regenerate autoconf
|
||||
autoreconf-2.71 -fi
|
||||
|
@ -42,6 +42,7 @@ src_configure() {
|
|||
MACHDEP=linux ac_sys_system=Linux \
|
||||
CPPFLAGS="-U__DATE__ -U__TIME__" \
|
||||
LDFLAGS="-L${LIBDIR}" \
|
||||
PYTHON_FOR_BUILD="python -B" \
|
||||
./configure \
|
||||
--build=i386-unknown-linux-musl \
|
||||
--host=i386-unknown-linux-musl \
|
||||
|
@ -53,9 +54,9 @@ src_configure() {
|
|||
src_compile() {
|
||||
# Regenerations
|
||||
rm Modules/_blake2/blake2s_impl.c
|
||||
make "${MAKEJOBS}" regen-all
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-all
|
||||
|
||||
make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
|
||||
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
Loading…
Reference in New Issue