Skip to content

Commit 96757a3

Browse files
authored
Remove temporary files and import dash_api to python3 env (#16033)
1. Remove useless temporary protobuf deb packages 2. Import dash_api to python3 env ### Why I did it 1. There are some temporary Debian packages,protobuf packages, needs to be deleted 2. The dash-api was installed in the system folder that cannot be imported by the virtual python3 environment. But the testcases of DASH in sonic-mgmt are executed in virtual python3 environment. ##### Work item tracking - Microsoft ADO **(number only)**: 17417902 #### How I did it 1. Add missed `&&` so that all protobuf debian packaged can be downloaded to the /tmp folder 2. Add ` --system-site-packages ` to env-python so that the system library can be accessed by virtual environment #### How to verify it Check the dash_api can be imported in env-python3 ``` AzDevOps@46a900cf8477:~$ source env-python3/bin/activate (env-python3) zegan@46a900cf8477:~$ ls bin env-python3 (env-python3) zegan@46a900cf8477:~$ python3 Python 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import dash_api >>> ```
1 parent 8524e56 commit 96757a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dockers/docker-sonic-mgmt/Dockerfile.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ debs/{{ deb }}{{' '}}
212212

213213
# Install protobuf 3.21.12
214214
RUN mkdir -p /tmp/protobuf \
215-
cd /tmp/protobuf \
215+
&& cd /tmp/protobuf \
216216
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
217217
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
218218
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf32_3.21.12-3_amd64.deb \
@@ -263,7 +263,7 @@ WORKDIR /var/$user
263263
# Add az symlink for backwards compatibility
264264
RUN mkdir bin && ln -s /usr/bin/az bin/az
265265

266-
RUN python3 -m venv env-python3
266+
RUN python3 -m venv --system-site-packages env-python3
267267

268268
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
269269
ENV VIRTUAL_ENV=env-python3

0 commit comments

Comments
 (0)