diff --git a/Makefile b/Makefile index d5f298d..00e2277 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,8 @@ export DETERMINISTIC_TESTS := false export ETESYNC_TESTS := false # Assume to run in Travis. Don't use this outside of a virtual machine. It will -# heavily "pollute" your system. +# heavily "pollute" your system, such as attempting to install a new Python +# systemwide. export CI := false # Whether to generate coverage data while running tests. @@ -79,7 +80,7 @@ install-test: install-servers [ -z "$(TEST_EXTRA_PACKAGES)" ] || pip install $(TEST_EXTRA_PACKAGES) install-style: install-docs - pip install flake8 flake8-import-order flake8-bugbear>=17.3.0 + pip install flake8 flake8-import-order 'flake8-bugbear>=17.3.0' autopep8 style: flake8 @@ -97,9 +98,6 @@ install-docs: docs: cd docs && make html -sh: # open subshell with default test config - $$SHELL; - linkcheck: sphinx-build -W -b linkcheck ./docs/ ./docs/_build/linkcheck/ @@ -113,7 +111,7 @@ release-deb: sh scripts/release-deb.sh ubuntu xenial sh scripts/release-deb.sh ubuntu zesty -install-dev: +install-dev: install-git-hooks pip install -e . [ "$(ETESYNC_TESTS)" = "false" ] || pip install -e .[etesync] set -xe && if [ "$(REQUIREMENTS)" = "devel" ]; then \ @@ -124,6 +122,13 @@ install-dev: pip install -U --force-reinstall $$(python setup.py --quiet minimal_requirements); \ fi +install-git-hooks: install-style + echo "make style-autocorrect" > .git/hooks/pre-commit + chmod +x .git/hooks/pre-commit + +style-autocorrect: + git diff --cached --name-only | egrep '\.py$$' | xargs --no-run-if-empty autopep8 -ri + ssh-submodule-urls: git submodule foreach "\ echo -n 'Old: '; \ diff --git a/docs/config.rst b/docs/config.rst index 00b41f1..d6a47a9 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -174,9 +174,8 @@ To use this storage type, you need to install some additional dependencies:: pip install vdirsyncer[google] Furthermore you need to register vdirsyncer as an application yourself to -obtain ``client_id`` and ``client_secret``, as `it is against Google's Terms of -Service to hardcode those into opensource software -`_: +obtain ``client_id`` and ``client_secret``, as it is against Google's Terms of +Service to hardcode those into opensource software [googleterms]_: 1. Go to the `Google API Manager `_ and create a new project under any name. @@ -198,6 +197,9 @@ The ``token_file`` parameter should be a filepath where vdirsyncer can later store authentication-related data. You do not need to create the file itself or write anything to it. +.. [googleterms] See `ToS `_, + section "Confidential Matters". + .. note:: You need to configure which calendars Google should offer vdirsyncer using diff --git a/docs/contributing.rst b/docs/contributing.rst index 6d3b0fd..4c4adb0 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -79,19 +79,19 @@ For many patches, it might suffice to just let Travis run the tests. However, Travis is slow, so you might want to run them locally too. For this, set up a virtualenv_ and run this inside of it:: - # install vdirsyncer from the repo into the virtualenv. Prerequisite for - # most other tasks. + # install: + # - vdirsyncer from the repo into the virtualenv + # - stylecheckers (flake8) and code formatters (autopep8) + # - git commit hook for autopep8 make install-dev make install-test # install test dependencies - make install-style # install dependencies for stylechecking - make install-docs # install dependencies for building documentation Then you can run:: - make test # The normal testsuite + make test # The normal testsuite make style # Stylechecker - make docs # Build the HTML docs, output is at docs/_build/html/ + make docs # Build the HTML docs, output is at docs/_build/html/ The ``Makefile`` has a lot of options that allow you to control which tests are run, and which servers are tested. Take a look at its code where they are all diff --git a/tests/storage/dav/__init__.py b/tests/storage/dav/__init__.py index 2da3d8b..77109e8 100644 --- a/tests/storage/dav/__init__.py +++ b/tests/storage/dav/__init__.py @@ -17,7 +17,7 @@ from vdirsyncer.vobject import Item from .. import StorageTests, get_server_mixin -dav_server = os.environ['DAV_SERVER'] +dav_server = os.environ.get('DAV_SERVER', 'skip') ServerMixin = get_server_mixin(dav_server)