diff options
author | bmw <bmw@users.noreply.github.com> | 2015-10-06 01:18:30 +0300 |
---|---|---|
committer | bmw <bmw@users.noreply.github.com> | 2015-10-06 01:18:30 +0300 |
commit | 410f9bf383ca22c382fe9abfd34b8657c0decb9e (patch) | |
tree | 2801565531081ea859c05490398d00dd0b3564df | |
parent | 4012e67c96e25ba4c3a44fadbf35cac5cb0b3d22 (diff) | |
parent | 26e03dbba29beb32d8c64844f7ffb32a383706e7 (diff) |
Merge pull request #847 from kuba/bootstrap
Developer virtualenv bootstrap scripts.
-rwxr-xr-x | bootstrap/archlinux.sh | 15 | ||||
-rw-r--r-- | bootstrap/dev/README | 1 | ||||
-rwxr-xr-x | bootstrap/dev/_venv_common.sh | 25 | ||||
-rwxr-xr-x | bootstrap/dev/venv.sh | 11 | ||||
-rwxr-xr-x | bootstrap/dev/venv3.sh | 8 | ||||
-rw-r--r-- | docs/contributing.rst | 43 | ||||
-rw-r--r-- | docs/using.rst | 2 |
7 files changed, 82 insertions, 23 deletions
diff --git a/bootstrap/archlinux.sh b/bootstrap/archlinux.sh index fbe0987fe..6de7c23d4 100755 --- a/bootstrap/archlinux.sh +++ b/bootstrap/archlinux.sh @@ -1,2 +1,15 @@ #!/bin/sh -pacman -S git python2 python2-virtualenv gcc dialog augeas openssl libffi ca-certificates
\ No newline at end of file + +# "python-virtualenv" is Python3, but "python2-virtualenv" provides +# only "virtualenv2" binary, not "virtualenv" necessary in +# ./bootstrap/dev/_common_venv.sh +pacman -S \ + git \ + python2 \ + python-virtualenv \ + gcc \ + dialog \ + augeas \ + openssl \ + libffi \ + ca-certificates \ diff --git a/bootstrap/dev/README b/bootstrap/dev/README new file mode 100644 index 000000000..759496187 --- /dev/null +++ b/bootstrap/dev/README @@ -0,0 +1 @@ +This directory contains developer setup. 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 c746c6ae7..3959ccee1 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -7,38 +7,37 @@ Contributing Hacking ======= -Start by :doc:`installing dependencies and setting up Let's Encrypt -<using>`. +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 <coding-style>`. -When you're done activate the virtualenv: -.. code-block:: shell +Bootstrap +--------- - source ./venv/bin/activate +Start by :ref:`installing Let's Encrypt prerequisites +<prerequisites>`. Then run: -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`_. +.. code-block:: shell -Install the development packages: + ./bootstrap/dev/venv.sh -.. code-block:: shell +Activate the virtualenv: - pip install -r requirements.txt -e acme -e .[dev,docs,testing] -e letsencrypt-apache -e letsencrypt-nginx -e letshelp-letsencrypt +.. code-block:: shell -.. 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. + source ./$VENV_NAME/bin/activate - This is roughly equivalent to `python setup.py develop`. For - more info see `man pip`. +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`_. -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 <coding-style>`. +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 ============= |