Do not allow passing arguments to Python during byte-compilation

This commit is contained in:
Lumir Balhar 2019-07-11 14:42:28 +02:00
parent 4493789fb8
commit eb3274394c
1 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,8 @@ py3_byte_compile () {\
PYTHONPATH="%{_rpmconfigdir}/redhat" $python_binary -s -B -m compileall2 -o 0 -o 1 -s $RPM_BUILD_ROOT -p / $bytecode_compilation_path \
}\
\
# Path to intepreter should not contain any arguments \
[[ "%1" =~ " -" ]] && echo "ERROR py_byte_compile: Path to interpreter should not contain any arguments" >&2 && exit 1 \
# Get version without a dot (36 instead of 3.6), bash doesn't compare floats well \
python_version=$(%1 -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") \
# compileall2 Python module is not compatible with Python < 3.4 \