From 6649af94790407a1d0a2bde72cc927ca881a64ad Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 27 Sep 2015 20:57:31 +0000 Subject: [PATCH 1/5] Developer virtualenv bootstrap scripts. --- bootstrap/dev/README | 1 + bootstrap/dev/_venv_common.sh | 25 +++++++++++++++ bootstrap/dev/venv.sh | 11 +++++++ bootstrap/dev/venv3.sh | 8 +++++ docs/contributing.rst | 59 ++++++++++++++++++----------------- docs/using.rst | 2 ++ 6 files changed, 77 insertions(+), 29 deletions(-) create mode 100644 bootstrap/dev/README create mode 100755 bootstrap/dev/_venv_common.sh create mode 100755 bootstrap/dev/venv.sh create mode 100755 bootstrap/dev/venv3.sh diff --git a/bootstrap/dev/README b/bootstrap/dev/README new file mode 100644 index 000000000..1509c24e0 --- /dev/null +++ b/bootstrap/dev/README @@ -0,0 +1 @@ +This directory contains developer setup. \ No newline at end of file diff --git a/bootstrap/dev/_venv_common.sh b/bootstrap/dev/_venv_common.sh new file mode 100755 index 000000000..2d84dc39b --- /dev/null +++ b/bootstrap/dev/_venv_common.sh @@ -0,0 +1,25 @@ +#!/bin/sh -xe + +VENV_NAME=${VENV_NAME:-venv} + +# .egg-info directories tend to cause bizzaire problems (e.g. `pip -e +# .` might unexpectedly install letshelp-letsencrypt only, in case +# `python letshelp-letsencrypt/setup.py build` has been called +# earlier) +rm -rf *.egg-info + +# virtualenv setup is NOT idempotent: shutil.Error: +# `/home/jakub/dev/letsencrypt/letsencrypt/venv/bin/python2` and +# `venv/bin/python2` are the same file +mv $VENV_NAME "$VENV_NAME.$(date +%s).bak" || true +virtualenv --no-site-packages $VENV_NAME $VENV_ARGS +. ./$VENV_NAME/bin/activate + +# Separately install setuptools and pip to make sure following +# invocations use latest +pip install -U setuptools +pip install -U pip +pip install "$@" + +echo "Please run the following command to activate developer environment:" +echo "source $VENV_NAME/bin/activate" diff --git a/bootstrap/dev/venv.sh b/bootstrap/dev/venv.sh new file mode 100755 index 000000000..90088ac9b --- /dev/null +++ b/bootstrap/dev/venv.sh @@ -0,0 +1,11 @@ +#!/bin/sh -xe +# Developer virtualenv setup for Let's Encrypt client + +./bootstrap/dev/_venv_common.sh \ + -r requirements.txt \ + -e acme[testing] \ + -e .[dev,docs,testing] \ + -e letsencrypt-apache \ + -e letsencrypt-nginx \ + -e letshelp-letsencrypt \ + -e letsencrypt-compatibility-test diff --git a/bootstrap/dev/venv3.sh b/bootstrap/dev/venv3.sh new file mode 100755 index 000000000..ccffffb83 --- /dev/null +++ b/bootstrap/dev/venv3.sh @@ -0,0 +1,8 @@ +#!/bin/sh -xe +# Developer Python3 virtualenv setup for Let's Encrypt + +export VENV_NAME="${VENV_NAME:-venv3}" +export VENV_ARGS="--python python3" + +./bootstrap/dev/_venv_common.sh \ + -e acme[testing] \ diff --git a/docs/contributing.rst b/docs/contributing.rst index c6443e3b2..6a9682494 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -7,39 +7,40 @@ Contributing Hacking ======= -Start by :doc:`installing dependencies and setting up Let's Encrypt -`. - -When you're done activate the virtualenv: - -.. code-block:: shell - - source ./venv/bin/activate - -This step should prepend you prompt with ``(venv)`` and save you from -typing ``./venv/bin/...``. It is also required to run some of the -`testing`_ tools. Virtualenv can be disabled at any time by typing -``deactivate``. More information can be found in `virtualenv -documentation`_. - -Install the development packages: - -.. code-block:: shell - - pip install -r requirements.txt -e acme -e .[dev,docs,testing] -e letsencrypt-apache -e letsencrypt-nginx -e letshelp-letsencrypt - -.. note:: `-e` (short for `--editable`) turns on *editable mode* in - which any source code changes in the current working - directory are "live" and no further `pip install ...` - invocations are necessary while developing. - - This is roughly equivalent to `python setup.py develop`. For - more info see `man pip`. - The code base, including your pull requests, **must** have 100% unit test coverage, pass our `integration`_ tests **and** be compliant with the :ref:`coding style `. + +Bootstrap +--------- + +Start by :ref:`installing Let's Encrypt prerequisites +`. Then run: + +.. code-block:: shell + + ./bootstrap/dev/venv.sh + ./bootstrap/dev/venv3.sh + +Both of the commands suggest to activate the virtualenv (you can +activate one at a time only): + +.. code-block:: shell + + source ./$VENV_NAME/bin/activate + +This step should prepend you prompt with ``($VENV_NAME)`` and save you +from typing ``./$VENV_NAME/bin/...``. It is also required to run some +of the `testing`_ tools. Virtualenv can be disabled at any time by +typing ``deactivate``. More information can be found in `virtualenv +documentation`_. + +Note that packages are installed in so called *editable mode*, in +which any source code changes in the current working directory are +"live" and no further ``./bootstrap/dev/venv.sh`` or ``pip install +...`` invocations are necessary while developing. + .. _`virtualenv documentation`: https://virtualenv.pypa.io diff --git a/docs/using.rst b/docs/using.rst index cfce29bae..53ecd72b5 100644 --- a/docs/using.rst +++ b/docs/using.rst @@ -42,6 +42,8 @@ above method instead. https://github.com/letsencrypt/letsencrypt/archive/master.zip +.. _prerequisites: + Prerequisites ============= From 85e5165b5d82f3700ba4c960b3f957f7c4d7d3d9 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 27 Sep 2015 20:59:07 +0000 Subject: [PATCH 2/5] nit: missing EOF newline --- bootstrap/dev/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/dev/README b/bootstrap/dev/README index 1509c24e0..759496187 100644 --- a/bootstrap/dev/README +++ b/bootstrap/dev/README @@ -1 +1 @@ -This directory contains developer setup. \ No newline at end of file +This directory contains developer setup. From eec5542cb3a479f57f6f69c407aa9aaae287e247 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Mon, 5 Oct 2015 21:39:34 +0000 Subject: [PATCH 3/5] lint archlinux bootstrap script --- bootstrap/archlinux.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bootstrap/archlinux.sh b/bootstrap/archlinux.sh index fbe0987fe..fb54c83d5 100755 --- a/bootstrap/archlinux.sh +++ b/bootstrap/archlinux.sh @@ -1,2 +1,11 @@ #!/bin/sh -pacman -S git python2 python2-virtualenv gcc dialog augeas openssl libffi ca-certificates \ No newline at end of file +pacman -S \ + git \ + python2 \ + python2-virtualenv \ + gcc \ + dialog \ + augeas \ + openssl \ + libffi \ + ca-certificates \ From 4cd5a8e42c4a31ab7f8520de3e3759ee64aff590 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Mon, 5 Oct 2015 21:40:55 +0000 Subject: [PATCH 4/5] Archlinux bootstrap: python-virtualenv --- bootstrap/archlinux.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap/archlinux.sh b/bootstrap/archlinux.sh index fb54c83d5..6de7c23d4 100755 --- a/bootstrap/archlinux.sh +++ b/bootstrap/archlinux.sh @@ -1,8 +1,12 @@ #!/bin/sh + +# "python-virtualenv" is Python3, but "python2-virtualenv" provides +# only "virtualenv2" binary, not "virtualenv" necessary in +# ./bootstrap/dev/_common_venv.sh pacman -S \ git \ python2 \ - python2-virtualenv \ + python-virtualenv \ gcc \ dialog \ augeas \ From 26e03dbba29beb32d8c64844f7ffb32a383706e7 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Mon, 5 Oct 2015 22:12:21 +0000 Subject: [PATCH 5/5] docs: remove venv3. --- docs/contributing.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 9629ddcc5..3959ccee1 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -21,10 +21,8 @@ Start by :ref:`installing Let's Encrypt prerequisites .. code-block:: shell ./bootstrap/dev/venv.sh - ./bootstrap/dev/venv3.sh -Both of the commands suggest to activate the virtualenv (you can -activate one at a time only): +Activate the virtualenv: .. code-block:: shell