Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Dockerfiles Python 3 cleanup (#3601)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicknezis authored Aug 21, 2020
1 parent 35ec34b commit 96dda44
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 154 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ addons:
packages:
- libtool-bin
- libcppunit-dev
- python3
- pkg-config
- python3-dev
- python3-wheel
- python3-venv
- wget
- zip
- zlib1g-dev
Expand Down
19 changes: 0 additions & 19 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ REQUESTS_SRC = "https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d

SETUPTOOLS_WHEEL = "https://pypi.python.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl"

VIRTUALENV_SRC = "https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz"

VIRTUALENV_PREFIX = "virtualenv-15.1.0"

WHEEL_SRC = "https://pypi.python.org/packages/c9/1d/bd19e691fd4cfe908c76c429fe6e4436c9e83583c4414b54f6c85471954a/wheel-0.29.0.tar.gz"

http_file(
Expand Down Expand Up @@ -229,21 +225,6 @@ http_file(
urls = [SETUPTOOLS_WHEEL],
)

http_archive(
name = "virtualenv",
build_file_content = "\n".join([
"load(\"@rules_python//python:defs.bzl\", \"py_binary\")",
"py_binary(",
" name = 'virtualenv',",
" srcs = ['virtualenv.py'],",
" data = glob(['**/*']),",
" visibility = ['//visibility:public'],",
")",
]),
sha256 = "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a",
strip_prefix = VIRTUALENV_PREFIX,
urls = [VIRTUALENV_SRC],
)
# end pex repos

# protobuf dependencies for C++ and Java
Expand Down
9 changes: 8 additions & 1 deletion bazel_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import datetime
import platform
import subprocess
import tempfile

sys.path.append('third_party/python/semver')
import semver
Expand Down Expand Up @@ -293,6 +294,11 @@ def discover_jdk():
print('Using %s:\t%s' % ('JDK'.ljust(20), jdk_path))
return jdk_path

def test_venv():
with tempfile.TemporaryDirectory() as tmpdirname:
if subprocess.run(["python3", "-m", "venv", tmpdirname]).returncode != 0:
fail("Python3 venv module is not installed.")

######################################################################
# Discover the linker directory
######################################################################
Expand Down Expand Up @@ -413,7 +419,8 @@ def main():
env_map['AUTOMAKE'] = discover_tool('automake', 'Automake', 'AUTOMAKE', '1.9.6')
env_map['AUTOCONF'] = discover_tool('autoconf', 'Autoconf', 'AUTOCONF', '2.6.3')
env_map['MAKE'] = discover_tool('make', 'Make', 'MAKE', '3.81')
env_map['PYTHON3'] = discover_tool('python3', 'Python3', 'PYTHON3', '3.4')
env_map['PYTHON3'] = discover_tool('python3', 'Python3', 'PYTHON3', '3.6')
test_venv()

if platform == 'Darwin':
env_map['LIBTOOL'] = discover_tool('glibtool', 'Libtool', 'LIBTOOL', '2.4.2')
Expand Down
1 change: 0 additions & 1 deletion docker/compile/Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ RUN yum -y install \
libtool \
make \
patch \
python \
python3-devel \
zip \
unzip \
Expand Down
57 changes: 0 additions & 57 deletions docker/compile/Dockerfile.ubuntu14.04

This file was deleted.

60 changes: 0 additions & 60 deletions docker/compile/Dockerfile.ubuntu16.04

This file was deleted.

5 changes: 3 additions & 2 deletions docker/compile/Dockerfile.ubuntu18.04
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ RUN apt-get update && apt-get -y install \
libunwind8 \
libcppunit-dev \
patch \
python \
python3-dev \
python3-venv \
pkg-config \
wget \
zip \
virtualenv \
unzip \
git \
curl \
tree \
openjdk-11-jdk-headless

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10

ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64

ENV bazelVersion 3.4.1
Expand Down
4 changes: 2 additions & 2 deletions docker/compile/Dockerfile.ubuntu20.04
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ RUN apt-get update && apt-get -y install \
libunwind8 \
libcppunit-dev \
patch \
python-is-python3 \
python3-dev \
python \
python3-venv \
pkg-config \
wget \
zip \
virtualenv \
unzip \
git \
curl \
Expand Down
4 changes: 3 additions & 1 deletion docker/test/Dockerfile.ubuntu18.04
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ RUN apt-get update && apt-get -y install \
libcppunit-dev \
patch \
python3-dev \
python3-venv \
wget \
zip \
virtualenv \
unzip \
git \
curl \
tree \
openjdk-11-jdk-headless

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10

ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64

ENV bazelVersion 3.4.1
Expand Down
6 changes: 3 additions & 3 deletions scripts/packages/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,9 @@ genrule(
"export RELEASE_FILE_DIR=$$(pwd)",
"export TMP_DIR=$$(mktemp -d -t heronpy.XXXXX)",
"echo $$TMP_DIR",
"$(location @virtualenv//:virtualenv) --no-download --quiet --clear $$TMP_DIR/venv",
"PS1= source $$TMP_DIR/venv/bin/activate",
# Create the virtual environment
'python3 -m venv $$TMP_DIR/venv --clear',
"VIRTUAL_ENV_DISABLE_PROMPT=1 source $$TMP_DIR/venv/bin/activate",
"export HERONPY_DIR=$$TMP_DIR/heronpy",
"export HERONPYAPI_UNZIP=$$TMP_DIR/heronapiunzip",
"export HERONPYSTREAMLET_UNZIP=$$TMP_DIR/heronstreamletunzip",
Expand Down Expand Up @@ -661,7 +662,6 @@ genrule(
"//heronpy/connectors:heron-pythonconnectors-package",
"//heronpy/proto:proto-py-package",
"//heronpy/streamlet:heron-python-streamlet-api-package",
"@virtualenv",
],
)

Expand Down
8 changes: 3 additions & 5 deletions tools/rules/pex/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ LINUX_EXECUTE = [
POST_EXECUTE = [
'ln -sf "$$OUTDIR" "$$TMPF"',
'VENV="$${TMPF}/venv"',
'$(location @virtualenv//:virtualenv) --no-download --quiet --clear "$$VENV"',
'# this is just to keep the activate script happy',
'PS1=',
'source "$$VENV/bin/activate"',
# Create the virtual environment
'python3 -m venv $$VENV --clear',
'VIRTUAL_ENV_DISABLE_PROMPT=1 source "$$VENV/bin/activate"',

'pip install pex \
--quiet --no-cache-dir --no-index --build $(@D)/pexbuild \
Expand Down Expand Up @@ -70,6 +69,5 @@ genrule(
executable = True,
message = "Bootstrapping pex",
output_to_bindir = True,
tools = ["@virtualenv"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion website2/website/scripts/python-doc-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ VENV=./venv/
echo $VENV
PIP_LOCATION=${HERON_ROOT_DIR}/bazel-bin/scripts/packages

virtualenv "$VENV"
python3 -m venv "$VENV"
source "$VENV/bin/activate"
pip3 install pdoc==0.3.2
pip3 install --ignore-installed six
Expand Down

0 comments on commit 96dda44

Please sign in to comment.