fix linux scripts, add patchelf

This commit is contained in:
Ondrej Samohel 2021-06-30 18:13:11 +02:00
parent 3515194d3c
commit d28f8cd1d4
No known key found for this signature in database
GPG key ID: 8A29C663C672C2B7
6 changed files with 33 additions and 33 deletions

View file

@ -1,5 +1,5 @@
# Build Pype docker image
FROM centos:7 AS builder
FROM centos:7 AS system_builder
ARG OPENPYPE_PYTHON_VERSION=3.7.10
LABEL org.opencontainers.image.name="pypeclub/openpype"
@ -22,6 +22,7 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
which \
git \
devtoolset-7-gcc* \
gcc-c++ \
make \
cmake \
curl \
@ -35,13 +36,19 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
openssl-devel \
tk-devel libffi-devel \
qt5-qtbase-devel \
patchelf \
autoconf \
automake \
&& yum clean all
RUN mkdir /opt/openpype
# RUN useradd -m pype
# RUN chown pype /opt/openpype
# USER pype
# we need to build our own patchelf
WORKDIR /temp-patchelf
RUN git clone https://github.com/NixOS/patchelf.git . \
&& source scl_source enable devtoolset-7 \
&& ./bootstrap.sh \
&& ./configure \
&& make \
&& make install
RUN curl https://pyenv.run | bash
ENV PYTHON_CONFIGURE_OPTS --enable-shared
@ -49,27 +56,21 @@ ENV PYTHON_CONFIGURE_OPTS --enable-shared
RUN echo 'export PATH="$HOME/.pyenv/bin:$PATH"'>> $HOME/.bashrc \
&& echo 'eval "$(pyenv init -)"' >> $HOME/.bashrc \
&& echo 'eval "$(pyenv virtualenv-init -)"' >> $HOME/.bashrc \
&& echo 'eval "$(pyenv init --path)"' >> $HOME/.bashrc
RUN source $HOME/.bashrc && pyenv install ${OPENPYPE_PYTHON_VERSION}
COPY . /opt/openpype/
RUN rm -rf /openpype/.poetry || echo "No Poetry installed yet."
# USER root
# RUN chown -R pype /opt/openpype
RUN chmod +x /opt/openpype/tools/create_env.sh && chmod +x /opt/openpype/tools/build.sh
# USER pype
&& echo 'eval "$(pyenv init --path)"' >> $HOME/.bashrc \
&& source $HOME/.bashrc \
&& pyenv install ${OPENPYPE_PYTHON_VERSION}
WORKDIR /opt/openpype
RUN cd /opt/openpype \
COPY . /opt/openpype/
RUN rm -rf /opt/openpype/.poetry || echo "No Poetry installed yet." \
&& chmod +x /opt/openpype/tools/create_env.sh \
&& chmod +x /opt/openpype/tools/build.sh \
&& source $HOME/.bashrc \
&& pyenv local ${OPENPYPE_PYTHON_VERSION}
RUN source $HOME/.bashrc \
&& ./tools/create_env.sh
RUN source $HOME/.bashrc \
&& ./tools/create_env.sh \
&& source $HOME/.bashrc \
&& ./tools/fetch_thirdparty_libs.sh
RUN source $HOME/.bashrc \
@ -77,6 +78,3 @@ RUN source $HOME/.bashrc \
&& cp /usr/lib64/libffi* ./build/exe.linux-x86_64-3.7/lib \
&& cp /usr/lib64/libssl* ./build/exe.linux-x86_64-3.7/lib \
&& cp /usr/lib64/libcrypto* ./build/exe.linux-x86_64-3.7/lib
RUN cd /opt/openpype \
rm -rf ./vendor/bin

View file

@ -58,7 +58,7 @@ BICyan='\033[1;96m' # Cyan
BIWhite='\033[1;97m' # White
args=$@
disable_submodule_update = 0
disable_submodule_update=0
while :; do
case $1 in
--no-submodule-update)
@ -122,7 +122,7 @@ clean_pyc () {
local path
path=$openpype_root
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
find "$path" -path ./build -prune -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
find "$path" -path ./build -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
echo -e "${BIGreen}DONE${RST}"
}
@ -228,3 +228,4 @@ if [ "$disable_submodule_update" == 1 ]; then
}
main
exit $?

View file

@ -126,7 +126,7 @@ clean_pyc () {
local path
path=$openpype_root
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
find "$path" -path ./build -prune -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
find "$path" -path ./build -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
echo -e "${BIGreen}DONE${RST}"
}
@ -177,7 +177,7 @@ main () {
echo -e "${BIGreen}>>>${RST} Installing dependencies ..."
fi
poetry install --no-root $poetry_verbosity || { echo -e "${BIRed}!!!${RST} Poetry environment installation failed"; return; }
poetry install --no-root --ansi $poetry_verbosity || { echo -e "${BIRed}!!!${RST} Poetry environment installation failed"; return; }
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
clean_pyc

View file

@ -32,7 +32,7 @@ main () {
openpype_version="$(python3 <<< ${version_command})"
echo -e "${BIGreen}>>>${RST} Running docker build ..."
docker build --pull --no-cache -t pypeclub/openpype:$openpype_version .
docker build --pull -t pypeclub/openpype:$openpype_version .
if [ $? -ne 0 ] ; then
echo -e "${BIRed}!!!${RST} Docker build failed."
return 1

View file

@ -73,14 +73,15 @@ _print("Handling PySide2 Qt framework ...")
pyside2_version = None
try:
pyside2_version = pyproject["openpype"]["pyside2"]["version"]
_print("We'll install PySide2{}".format(pyside2_version))
except AttributeError:
_print("No PySide2 version was specified, using latest available.", 2)
pyside2_arg = "PySide2" if pyside2_version else "PySide2{}".format(pyside2_version) # noqa: E501
pyside2_arg = "PySide2" if not pyside2_version else "PySide2{}".format(pyside2_version) # noqa: E501
try:
subprocess.run(
[sys.executable, "-m", "pip", "install", "--upgrade",
pyside2_arg, "-t", str(openpype_root / "vendor/python")], check=True)
pyside2_arg, "-t", str(openpype_root / "vendor/python")], check=True, stdout=subprocess.DEVNULL)
except subprocess.CalledProcessError as e:
_print("Error during PySide2 installation.", 1)
_print(str(e), 1)

View file

@ -99,8 +99,8 @@ main () {
pushd "$openpype_root" > /dev/null || return > /dev/null
echo -e "${BIGreen}>>>${RST} Running Pype tool ..."
echo -e "${BIGreen}>>>${RST} Fetching third party dependencies ..."
poetry run python "$openpype_root/tools/fetch_thirdparty_libs.py"
}
main
main