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 >>> ```
This commit is contained in:
parent
8524e563d3
commit
96757a335c
@ -212,7 +212,7 @@ debs/{{ deb }}{{' '}}
|
||||
|
||||
# Install protobuf 3.21.12
|
||||
RUN mkdir -p /tmp/protobuf \
|
||||
cd /tmp/protobuf \
|
||||
&& cd /tmp/protobuf \
|
||||
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
|
||||
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
|
||||
&& 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
|
||||
# Add az symlink for backwards compatibility
|
||||
RUN mkdir bin && ln -s /usr/bin/az bin/az
|
||||
|
||||
RUN python3 -m venv env-python3
|
||||
RUN python3 -m venv --system-site-packages env-python3
|
||||
|
||||
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
||||
ENV VIRTUAL_ENV=env-python3
|
||||
|
Loading…
Reference in New Issue
Block a user