Update python3_fixup

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
Stephen Gallagher 2022-11-01 10:15:50 -04:00
parent 7c7a75f64b
commit 64be0117c5
No known key found for this signature in database
GPG key ID: 45DB85A568286D11

View file

@ -16,12 +16,6 @@
%bcond_with bundled %bcond_with bundled
%endif %endif
%if 0%{?rhel} && 0%{?rhel} < 9
%bcond_without python3_fixup
%else
%bcond_with python3_fixup
%endif
%if 0%{?rhel} && 0%{?rhel} < 8 %if 0%{?rhel} && 0%{?rhel} < 8
%bcond_without bundled_zlib %bcond_without bundled_zlib
%else %else
@ -35,7 +29,7 @@
# Heavy-handed approach to avoiding issues with python # Heavy-handed approach to avoiding issues with python
# bytecompiling files in the node_modules/ directory # bytecompiling files in the node_modules/ directory
%global __python %{__python3} %global __python %{python3}
# == Master Relase == # == Master Relase ==
# This is used by both the nodejs package and the npm subpackage that # This is used by both the nodejs package and the npm subpackage that
@ -95,7 +89,7 @@
%global icu_version %{icu_major}.%{icu_minor} %global icu_version %{icu_major}.%{icu_minor}
%global icudatadir %{nodejs_datadir}/icudata %global icudatadir %{nodejs_datadir}/icudata
%{!?little_endian: %global little_endian %(%{__python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")} %{!?little_endian: %global little_endian %(%{python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")}
# " this line just fixes syntax highlighting for vim that is confused by the above and continues literal # " this line just fixes syntax highlighting for vim that is confused by the above and continues literal
@ -153,7 +147,7 @@ BuildRequires: make
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-jinja2 BuildRequires: python%{python3_pkgversion}-jinja2
%if !%{with python3_fixup} %if 0%{?fedora} || 0%{?rhel} >= 9
BuildRequires: python-unversioned-command BuildRequires: python-unversioned-command
%endif %endif
%if %{with bundled_zlib} %if %{with bundled_zlib}
@ -408,15 +402,9 @@ rm -rf deps/brotli
rm -rf deps/v8/third_party/jinja2 rm -rf deps/v8/third_party/jinja2
rm -rf tools/inspector_protocol/jinja2 rm -rf tools/inspector_protocol/jinja2
# Replace any instances of unversioned python' with python3 # Replace any instances of unversioned python with python3
%if %{with python3_fixup} pfiles=( $(grep -rl python) )
pathfix.py -i %{__python3} -pn $(find -type f ! -name "*.js") %py3_shebang_fix ${pfiles[@]}
find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python3~" {} \;
find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python3~" {} \;
sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py
sed -i "s~usr\/bin\/python.*$~usr\/bin\/python3~" ./deps/v8/tools/mb/mb_unittest.py
find . -type f -exec sed -i "s~python -c~python3 -c~" {} \;
%endif
%build %build
@ -438,9 +426,7 @@ find . -type f -exec sed -i "s~python -c~python3 -c~" {} \;
export CC='%{__cc}' export CC='%{__cc}'
export CXX='%{__cxx}' export CXX='%{__cxx}'
%if %{with python3_fixup} export NODE_GYP_FORCE_PYTHON=%{python3}
export NODE_GYP_FORCE_PYTHON=%{__python3}
%endif
# build with debugging symbols and add defines from libuv (#892601) # build with debugging symbols and add defines from libuv (#892601)
# Node's v8 breaks with GCC 6 because of incorrect usage of methods on # Node's v8 breaks with GCC 6 because of incorrect usage of methods on
@ -459,7 +445,7 @@ extra_cflags=(
export CFLAGS="%{optflags} ${extra_cflags[*]}" CXXFLAGS="%{optflags} ${extra_cflags[*]}" export CFLAGS="%{optflags} ${extra_cflags[*]}" CXXFLAGS="%{optflags} ${extra_cflags[*]}"
export LDFLAGS="%{build_ldflags}" export LDFLAGS="%{build_ldflags}"
%{__python3} configure.py \ %{python3} configure.py \
--ninja \ --ninja \
--enable-lto \ --enable-lto \
--prefix=%{_prefix} \ --prefix=%{_prefix} \