OCR-D/ocrd_all

> $PREFIX/bin/activate

mikegerber opened this issue · 6 comments

The Dockerfile has this construct here:

# we want to use PREFIX as "venv", so we need activate (as no-op)
RUN echo "> $PREFIX/bin/activate" >> docker.sh

Does this construct create an empty file $PREFIX/bin/activate because the Docker build does not have stdin? Why not use a more explicit construct like truncate -s0 or even touch?

Context: A team member asked me what this does and I got the meaning wrong the first ime - that's a bad sign.

Does this construct create an empty file $PREFIX/bin/activate

yes. And the context is: users may wish to run /build/Makefile targets in the container to update and install modules via git. Since in the container we do not use a top-level venv, we have to simulate one here.

because the Docker build does not have stdin?

I don't understand that part.

Why not use a more explicit construct like truncate -s0 or even touch?

Yes, touch would have done, too.

because the Docker build does not have stdin?

I don't understand that part.

If you do > $PREFIX/bin/activate in zsh, it waits for stdin (to write to the file). bash behaves differently, which I found out today and just creates an empty file...

Ah, understood. (Never used zsh in my life :-)

thanks for the clarification, makes total sense!

Note: With the recent changes, the top level has become a true venv again.

Feel free to reopen if necessary.