Skip to content

Commit

Permalink
vortex-python3.spec: Install pip when installing rpm
Browse files Browse the repository at this point in the history
Installing pip during the build was not working when the package was already installed.
  • Loading branch information
tim-vdm committed Jun 22, 2020
1 parent 0b82af2 commit 886cd80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions SPECS/vortex-python3.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%global minor_version 4
%global patch_version 4
# RPM package release version
%global release_version 1
%global release_version 2

# bundle name
%global bundle_name %{getenv:VORTEX_BUNDLE}
Expand Down Expand Up @@ -122,7 +122,6 @@ Source0: https://github.com/tim-vdm/cpython/archive/%{archive_file}

Requires: vortex-%{bundle_name}-openssl

Provides: %{install_dir}/bin/python

%description
Custom Vortex python build.
Expand Down Expand Up @@ -154,7 +153,12 @@ export VORTEX_BUNDLE_ROOT=%{install_dir}
--enable-loadable-sqlite-extensions \
--with-dtrace \
--with-lto \
--with-ssl-default-suites=openssl
--with-ssl-default-suites=openssl \
--with-ensurepip=no \
LDFLAGS=-Wl,-rpath='%{install_dir}/lib'

#LDFLAGS="-Wl,-rpath,'\$\$ORIGIN/../lib' -Wl,-z,origin"


%make_build

Expand All @@ -170,18 +174,18 @@ export VORTEX_BUNDLE_ROOT=%{install_dir}
make DESTDIR=%{buildroot} INSTALL="install -p" install

%global pybasever %{major_version}.%{minor_version}
# Make sure the BUILDROOT is not part of any file (for buildrpm's check-buildroot)
sed -i "s|%{buildroot}||g" %{buildroot}%{install_dir}/lib/python%{pybasever}/site-packages/setuptools-18.2.dist-info/RECORD
sed -i "s|%{buildroot}||g" %{buildroot}%{install_dir}/lib/python%{pybasever}/site-packages/pip-7.1.2.dist-info/RECORD

# Fix shebangs before buildrpm's brp-mangle-shebangs changes them to the system's python
find %{buildroot} -type f -exec sed -i "s|#\!/usr/bin/env python3|#\!%{install_dir}/bin/python3|g" {} \;
find %{buildroot} -type f -exec sed -i "s|#\! /usr/bin/env python3|#\!%{install_dir}/bin/python3|g" {} \;
find %{buildroot} -type f -exec sed -i "s|#\! /usr/local/bin/python|#\!%{install_dir}/bin/python|g" {} \;
find %{buildroot} -type f -exec sed -i "s|#\! /usr/local/bin/python|#\!%{install_dir}/bin/python3|g" {} \;
sed -i "s|#\!/usr/bin/env python|#\!%{install_dir}/bin/python3|g" %{buildroot}%{install_dir}/lib/python%{pybasever}/encodings/rot_13.py
sed -i "s|#\!/usr/bin/env python|#\!%{install_dir}/bin/python3|g" %{buildroot}%{install_dir}/lib/python%{pybasever}/lib2to3/tests/data/different_encoding.py
sed -i "s|#\!/usr/bin/env python|#\!%{install_dir}/bin/python3|g" %{buildroot}%{install_dir}/lib/python%{pybasever}/lib2to3/tests/data/false_encoding.py

%post
# Install pip
%{install_dir}/bin/python3 -m ensurepip

%postun
# remove files installed by pip packages etc.
Expand All @@ -194,6 +198,8 @@ rm -rf %{install_dir}/lib/python%{pybasever}


%changelog
* Mon Jun 22 2020 [email protected]
- Do not install pip during build (this was not working when the package was already installed).
* Tue May 26 2020 [email protected]
- Use bundle name
* Tue May 19 2020 [email protected]
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build_package(ctx, package):
# make sure the $HOME/rpmbuild directories exist
ctx.run("rpmdev-setuptree")
copy_patches()
ctx.run("rpmbuild -bb {}".format(get_spec_path(package)))
ctx.run("QA_RPATHS=$(( 0x0002 )) rpmbuild -bb {}".format(get_spec_path(package)))

@task
def build_source_package(ctx, package):
Expand Down

0 comments on commit 886cd80

Please sign in to comment.