Skip to content

Commit

Permalink
enable building more python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchetti committed Oct 1, 2018
1 parent 8022816 commit 517d910
Showing 1 changed file with 15 additions and 38 deletions.
53 changes: 15 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
.PHONY: clean images image2 image3 launch notebook2 notebook3 package dist test dist run shell shell2 shell3 dist-run dist-run2 dist-run3
.PHONY: clean images image% launch notebook% package dist run test test% shell shell% dist-run dist-run%

NB_UID=$(shell id -u)
NB_GID=$(shell id -g)

PY2=rstudio/rsconnect-jupyter-py2
PY3=rstudio/rsconnect-jupyter-py3
IMAGE=rstudio/rsconnect-jupyter-py

clean:
rm -rf build/ dist/ rsconnect.egg-info/

images: image2 image3
images: image2 image3.4 image3.5 image3.6 image3.7

image2:
image%:
docker build \
--tag $(PY2) \
--tag $(IMAGE)$* \
--file Dockerfile \
--build-arg BASE_IMAGE=continuumio/miniconda:4.4.10 \
--build-arg NB_UID=$(NB_UID) \
--build-arg NB_GID=$(NB_GID) \
--build-arg PY_VERSION=2 \
.

image3:
docker build \
--tag $(PY3) \
--file Dockerfile \
--build-arg BASE_IMAGE=continuumio/miniconda3:4.4.10 \
--build-arg NB_UID=$(NB_UID) \
--build-arg NB_GID=$(NB_GID) \
--build-arg PY_VERSION=3 \
--build-arg PY_VERSION=$* \
.

launch:
Expand All @@ -43,30 +32,24 @@ launch:
/rsconnect/run.sh $(TARGET)


notebook2:
make DOCKER_IMAGE=$(PY2) PY_VERSION=2 TARGET=run launch

notebook3:
make DOCKER_IMAGE=$(PY3) PY_VERSION=3 TARGET=run launch
notebook%:
make DOCKER_IMAGE=$(IMAGE)$* PY_VERSION=$* TARGET=run launch

test:
# TODO run in container
python -V
python -Wi setup.py test

test2:
make DOCKER_IMAGE=$(PY2) PY_VERSION=2 TARGET=test launch

test3:
make DOCKER_IMAGE=$(PY3) PY_VERSION=3 TARGET=test launch
test%:
make DOCKER_IMAGE=rstudio/rsconnect-jupyter-py$* PY_VERSION=$* TARGET=test launch

dist:
# wheels don't get built if _any_ file it tries to touch has a timestamp < 1980
# (system files) so use the current timestamp as a point of reference instead
SOURCE_DATE_EPOCH="$(shell date +%s)"; python setup.py bdist_wheel

package:
make DOCKER_IMAGE=$(PY3) PY_VERSION=3 TARGET=dist launch
make DOCKER_IMAGE=$(IMAGE)3 PY_VERSION=3 TARGET=dist launch

run:
# link python package
Expand All @@ -83,17 +66,11 @@ run:
shell:
bash

shell2:
make DOCKER_IMAGE=$(PY2) PY_VERSION=2 TARGET=shell launch

shell3:
make DOCKER_IMAGE=$(PY3) PY_VERSION=3 TARGET=shell launch

dist-run2:
make DOCKER_IMAGE=$(PY2) PY_VERSION=2 TARGET=dist-run launch
shell%:
make DOCKER_IMAGE=$(IMAGE)$* PY_VERSION=$* TARGET=shell launch

dist-run3:
make DOCKER_IMAGE=$(PY3) PY_VERSION=3 TARGET=dist-run launch
dist-run%:
make DOCKER_IMAGE=$(IMAGE)$* PY_VERSION=$* TARGET=dist-run launch

dist-run: dist
pip install dist/rsconnect-1.0.0-py2.py3-none-any.whl
Expand Down

0 comments on commit 517d910

Please sign in to comment.