diff --git a/CHANGES.txt b/CHANGES.txt index f0fc64cbb8..93eaeefdae 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,8 @@ New in master Features -------- +* Support passing ``--poll`` to ``nikola auto`` to better deal with symlink farms. + Bugfixes -------- diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 060842c704..bafc9f691a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -66,7 +66,7 @@ Here are some guidelines about how you can contribute to Nikola: * **Try writing some tests** if possible — again, following existing tests is often easiest, and a good way to tell whether the feature you are modifying is easily testable. -* **Test your code.** If you can, run the test suite with ``pytest tests/`` +* **Test your code.** If you can, run the test suite with ``f tests/`` (you will need to install pytest and some other requirements, see ``requirements-tests.txt``). Alternatively, you can push, make a PR and wait for our CI to pick up and test your changes (but note that workflows for new diff --git a/docs/theming.rst b/docs/theming.rst index 5beecd1f05..6ac20d2b4d 100644 --- a/docs/theming.rst +++ b/docs/theming.rst @@ -6,7 +6,7 @@ .. description: .. author: The Nikola Team -:Version: 8.3.0 +:Version: 8.3.X :Author: Roberto Alsina .. class:: alert alert-primary float-md-right diff --git a/nikola/plugins/command/auto/__init__.py b/nikola/plugins/command/auto/__init__.py index aecbe4114d..d3f95492fa 100644 --- a/nikola/plugins/command/auto/__init__.py +++ b/nikola/plugins/command/auto/__init__.py @@ -57,8 +57,10 @@ try: from watchdog.observers import Observer + from watchdog.observers.polling import PollingObserver except ImportError: Observer = None + PollingObserver = None LRJS_PATH = os.path.join(os.path.dirname(__file__), 'livereload.js') REBUILDING_REFRESH_DELAY = 0.35 @@ -159,6 +161,16 @@ class CommandAuto(Command): 'type': str, 'help': "Database backend ('dbm', 'json', 'sqlite3')", 'section': 'Arguments passed to `nikola build`' + }, + { + # We might be able to improve on this + # if and when https://github.com/gorakhargosh/watchdog/issues/365 + # is ever fixed. + 'name': 'poll', + 'long': 'poll', + 'default': False, + 'type': bool, + 'help': 'Use polling to notice changes behind symbolic links.' } ] @@ -256,7 +268,7 @@ def _execute(self, options, args): # Run an initial build so we are up-to-date. The server is running, but we are not watching yet. loop.run_until_complete(self.run_initial_rebuild()) - self.wd_observer = Observer() + self.wd_observer = Observer() if not options['poll'] else PollingObserver() # Watch output folders and trigger reloads if self.has_server: self.wd_observer.schedule(NikolaEventHandler(self.reload_page, loop), out_folder, recursive=True) diff --git a/tests/integration/test_dev_server.py b/tests/integration/test_dev_server.py index 64f44e7c61..53f2af9e2e 100644 --- a/tests/integration/test_dev_server.py +++ b/tests/integration/test_dev_server.py @@ -60,7 +60,8 @@ def test_serves_root_dir( "port": find_unused_port(), "db-file": "/dev/null", "backend": "No backend", - "no-server": False + "no-server": False, + "poll": False } # We start an event loop, run the test in an executor,