Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python migration towards pth instead of PATHs #3874

Merged
merged 4 commits into from Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 19 additions & 17 deletions py2-numpy.spec
Expand Up @@ -3,7 +3,9 @@
## INITENV SET PY2_NUMPY_REAL_VERSION %{realversion}

Source: https://github.com/numpy/numpy/releases/download/v%{realversion}/numpy-%{realversion}.tar.gz
Requires: python py2-setuptools zlib OpenBLAS
Requires: python zlib OpenBLAS
#py2-setuptools
BuildRequires: py2-pip

%define pythonver %(echo %{allpkgreqs} | tr ' ' '\\n' | grep ^external/python/ | cut -d/ -f3 | cut -d. -f 1,2)
%define numpyArch %(uname -m)
Expand Down Expand Up @@ -32,27 +34,27 @@ library_dirs = $OPENBLAS_ROOT/lib
[atlas]
atlas_libs = openblas
atlas_dirs = $OPENBLAS_ROOT/lib
[build]
fcompiler=gnu95
EOF

mkdir -p %i/${PYTHON_LIB_SITE_PACKAGES}

python setup.py build %{makeprocesses} --fcompiler=gnu95
PYTHON27PATH=%i/${PYTHON_LIB_SITE_PACKAGES}:$PYTHON27PATH python setup.py install --prefix=%i
sed -ideleteme 's|#!.*/bin/python|#!/usr/bin/env python|' \
%{i}/bin/f2py \
%{i}/lib/python*/site-packages/numpy-*/EGG-INFO/scripts/f2py \
%{i}/lib/python*/site-packages/numpy-*/numpy/core/tests/test_arrayprint.py \
%{i}/lib/python*/site-packages/numpy-*/numpy/distutils/from_template.py \
%{i}/lib/python*/site-packages/numpy-*/numpy/distutils/conv_template.py


find %{i} -name '*deleteme' -delete
export PYTHONUSERBASE=%i
pip install . --user

perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/*

#afaik, this functionality is not needed - but keep it for now.
mkdir %{i}/c-api
PYTHONV=$(echo $PYTHON_VERSION | cut -f1,2 -d.)
OSARCH=$(uname -m)
[ -d %{i}/${PYTHON_LIB_SITE_PACKAGES}/numpy-%{realversion}-py${PYTHONV}-linux-$OSARCH.egg/numpy/core ] || exit 1
ln -s ../${PYTHON_LIB_SITE_PACKAGES}/numpy-%{realversion}-py${PYTHONV}-linux-$OSARCH.egg/numpy/core %{i}/c-api/core
[ -d %{i}/${PYTHON_LIB_SITE_PACKAGES}/numpy/core ] || exit 1
ln -s ../${PYTHON_LIB_SITE_PACKAGES}/numpy/core %{i}/c-api/core


%post
%{relocateConfig}lib/python*/site-packages/numpy-*.egg/numpy/__config__.py
%{relocateConfig}lib/python*/site-packages/numpy-*.egg/numpy/distutils/__config__.py
%{relocateConfig}lib/python*/site-packages/numpy-*.egg/numpy/distutils/site.cfg
%{relocateConfig}lib/python*/site-packages/numpy/__config__.py
%{relocateConfig}lib/python*/site-packages/numpy/distutils/__config__.py
%{relocateConfig}lib/python*/site-packages/numpy/distutils/site.cfg

14 changes: 6 additions & 8 deletions py2-sqlalchemy.spec
Expand Up @@ -2,11 +2,7 @@
## INITENV +PATH PYTHON27PATH %i/${PYTHON_LIB_SITE_PACKAGES}

Source: https://pypi.python.org/packages/ca/ca/c2436fdb7bb75d772d9fa17ba60c4cfded6284eed053a7274b2beb96596a/SQLAlchemy-%{realversion}.tar.gz
Requires: python py2-setuptools

#%define pythonver %(echo %{allpkgreqs} | tr ' ' '\\n' | grep ^external/python/ | cut -d/ -f3 | cut -d. -f 1,2)
#%define pyArch %(uname -m)

Requires: python py2-pip

Patch0: py2-sqlalchemy-1.1.4-add-frontier-dialect
Patch1: py2-sqlalchemy-1.1.4-fix-sqlite-dialect-timestamp
Expand All @@ -17,9 +13,11 @@ Patch1: py2-sqlalchemy-1.1.4-fix-sqlite-dialect-timestamp
%patch1 -p1

%build
python setup.py build

%install
mkdir -p %{i}/${PYTHON_LIB_SITE_PACKAGES}
PYTHON27PATH=%{i}/${PYTHON_LIB_SITE_PACKAGES}:${PYTHON27PATH} python setup.py install --skip-build --prefix=%{i}
export PYTHONUSERBASE=%i
pip install . --user




1 change: 1 addition & 0 deletions py2-tensorflow.spec
Expand Up @@ -5,6 +5,7 @@
Source: none

BuildRequires: tensorflow-sources
BuildRequires: py2-setuptools
Requires: python
BuildRequires: py2-pip
Requires: py2-funcsigs py2-protobuf py2-pbr py2-six py2-packaging py2-appdirs py2-setuptools py2-pyparsing py2-numpy py2-mock py2-werkzeug
Expand Down
4 changes: 2 additions & 2 deletions python3.spec
@@ -1,8 +1,8 @@
### RPM external python3 3.6.4
## INITENV +PATH PATH %{i}/bin
## INITENV +PATH LD_LIBRARY_PATH %{i}/lib
## INITENV SETV PYTHON_LIB_SITE_PACKAGES lib/python%{pythonv}/site-packages
## INITENV SETV PYTHONHASHSEED random
## INITENV SETV PYTHON3_LIB_SITE_PACKAGES lib/python%{pythonv}/site-packages
## INITENV SETV PYTHON3HASHSEED random
# OS X patches and build fudging stolen from fink
%define pythonv %(echo %realversion | cut -d. -f 1,2)
%define python_major %(echo %realversion | cut -d. -f 1)
Expand Down
11 changes: 11 additions & 0 deletions scramv1-tool-conf.file
Expand Up @@ -95,5 +95,16 @@ if [ -e $SCRAMV1_ROOT/bin/chktool ] ; then
rm -f %i/errors.log
fi


py27List=`echo ${PYTHON27PATH} | tr ':' '\n'`

mkdir -p %{i}/${PYTHON_LIB_SITE_PACKAGES}
touch %{i}/${PYTHON_LIB_SITE_PACKAGES}/tool-deps.pth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidlange6 , we also need to relocate this file in %post otherwise it will have build paths instead of install.

for pkg in ${py27List} ; do
echo "adding $pkg"
echo "$pkg" >> %{i}/${PYTHON_LIB_SITE_PACKAGES}/tool-deps.pth
done


%post
%{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/tools -type f)
1 change: 1 addition & 0 deletions tensorflow-sources.spec
Expand Up @@ -7,6 +7,7 @@
Source: git+https://github.com/%{github_user}/tensorflow.git?obj=%{branch}/%{tag}&export=tensorflow-%{realversion}&output=/tensorflow-%{realversion}-%{tag}.tgz

BuildRequires: bazel eigen protobuf gcc
BuildRequires: py2-setuptools
Requires: py2-numpy python py2-wheel

%prep
Expand Down