[build] Use pip to install setup.py dependency instead of python setup.py install (#8997)

#### Why I did it
Fix a recent build error introduced by a pre-release redis-py. This is a general issue because `python setup.py install` (ie `easy_instal`) does not ignore pre-release versions. The fix is suggested by https://github.com/pypa/setuptools/issues/855#issuecomment-583803959
This commit is contained in:
Qi Luo 2021-10-26 21:12:45 -07:00 committed by GitHub
parent 4ad5f2af3f
commit 4bda0a921f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 28 deletions

View File

@ -643,6 +643,8 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA
pushd $($*_SRC_PATH) $(LOG_SIMPLE)
# apply series of patches if exist
if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi
# Use pip instead of later setup.py to install dependencies into user home, but uninstall self
pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python setup.py --name`
if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi
python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG)
# clean up

View File

@ -1,25 +0,0 @@
Pin the redis package to version 3.5.3 (the last version that supports both
Python 2 and 3).
Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
diff --git a/requirements.txt b/requirements.txt
index 7800f0f..3fc0632 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-redis
+redis==3.5.3
diff --git a/setup.py b/setup.py
index 8ccf31f..6db9ec4 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ setup(name=package_name,
author_email='oleg@bsdpower.com',
url='http://github.com/p/redis-dump-load',
py_modules=['redisdl'],
- install_requires=['redis'],
+ install_requires=['redis==3.5.3'],
data_files=[
(doc_dir, data_files),
],

View File

@ -1,3 +1,2 @@
0001-Use-pipelines-when-dumping-52.patch
0002-Fix-setup.py-for-test-and-bdist_wheel.patch
0003-use-redis-3.5.3.patch

View File

@ -85,8 +85,7 @@ setup(
'./yang-models/sonic-tc-queue-map.yang',
'./yang-models/sonic-pfc-priority-queue-map.yang',
'./yang-models/sonic-pfc-priority-priority-group-map.yang',
'./yang-models/sonic-port-qos-map.yang',
'./yang-models/sonic_yang_tree']),
'./yang-models/sonic-port-qos-map.yang']),
],
zip_safe=False,
)