[build] Add Support For Python 3 Build

CONiC config gen requires jinja2<3.0.0 for stretch and byangbind
versions 0.60.0/0.80.1 for Python 2/3 respectively. byangbind
is installed in the build docker because when it installed it
pulls enum34 as dependent package which is not required for
Python 3 and it breaks the build.

signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
This commit is contained in:
Tamer Ahmed 2020-09-28 19:20:15 -07:00 committed by Tamer Ahmed
parent 79bda7d0d6
commit c55bb03cfc
2 changed files with 17 additions and 6 deletions

View File

@ -242,7 +242,9 @@ RUN apt-get update && apt-get install -y \
sphinx-common \ sphinx-common \
python3-sphinx \ python3-sphinx \
# For sonic config engine testing # For sonic config engine testing
python-dev \
python-lxml \ python-lxml \
python3-lxml \
python-jinja2 \ python-jinja2 \
python-netaddr \ python-netaddr \
python-ipaddr \ python-ipaddr \
@ -362,9 +364,11 @@ RUN pip install \
crc16 crc16
# For sonic config engine testing # For sonic config engine testing
RUN pip install pyangbind==0.6.0 # Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
# Note: force upgrade debian packaged jinja2, if installed # enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module
RUN pip install --force-reinstall --upgrade "jinja2>=2.10" # https://github.com/robshakir/pyangbind/issues/232
RUN pip3 install pyangbind==0.8.1
RUN pip3 uninstall -y enum34
# For templating # For templating
RUN pip install j2cli==0.3.10 RUN pip install j2cli==0.3.10

View File

@ -241,7 +241,9 @@ RUN apt-get update && apt-get install -y \
sphinx-common \ sphinx-common \
python3-sphinx \ python3-sphinx \
# For sonic config engine testing # For sonic config engine testing
python-dev \
python-lxml \ python-lxml \
python3-lxml \
python-jinja2 \ python-jinja2 \
python-netaddr \ python-netaddr \
python-ipaddr \ python-ipaddr \
@ -341,10 +343,15 @@ RUN pip install \
ctypesgen==0.r125 \ ctypesgen==0.r125 \
crc16 crc16
# Note: Stick with Jinja2 2.x branch as the 3.x dropped support for Python 2.7
RUN pip install --force-reinstall --upgrade "Jinja2<3.0.0"
# For sonic config engine testing # For sonic config engine testing
RUN pip install pyangbind==0.6.0 # Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
# Note: force upgrade debian packaged jinja2, if installed # enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module
RUN pip install --force-reinstall --upgrade "jinja2>=2.10" # https://github.com/robshakir/pyangbind/issues/232
RUN pip3 install pyangbind==0.8.1
RUN pip3 uninstall -y enum34
# For templating # For templating
RUN pip install j2cli==0.3.10 RUN pip install j2cli==0.3.10