Repository: getnikola/nikola

Issue:
Auto should ignore files called `.goutputstream-*` or end with ~
GTK apps like gedit sometimes produce a temporary file called ..goutputstream-madness in the same directory as you’re creating files to. I beleive it serves the same backup-on-write purpose file.txt~? In any case, it causes auto to rebuild way more than it ought to eve though they exists for less than a second.

```
[2015-07-23T13:35:48Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:35:50Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:52Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:54Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:35:56Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:59Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:02Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:04Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:08Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:36:11Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:14Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
```

Auto should ignore files called `.goutputstream-*` or end with ~
GTK apps like gedit sometimes produce a temporary file called ..goutputstream-madness in the same directory as you’re creating files to. I beleive it serves the same backup-on-write purpose file.txt~? In any case, it causes auto to rebuild way more than it ought to eve though they exists for less than a second.

```
[2015-07-23T13:35:48Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:35:50Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:52Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:54Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:35:56Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:35:59Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:02Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:04Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:08Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
[2015-07-23T13:36:11Z] INFO: auto: REBUILDING SITE (from content/opinion/.goutputstream-Z0UJ2X)
Scanning posts.............done!
[2015-07-23T13:36:14Z] INFO: auto: REBUILDING SITE (from content/opinion)
Scanning posts.............done!
```



Discussion:

Resolving patch:
diff --git a/nikola/plugins/command/auto/__init__.py b/nikola/plugins/command/auto/__init__.py
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -248,6 +248,11 @@ def __call__(self, environ, start_response):
                 os.kill(os.getpid(), 15)
 
     def do_rebuild(self, event):
+        fname = os.path.basename(event.src_path)
+        if (fname.endswith('~') or
+                fname.startswith('.') or
+                os.path.isdir(event.src_path)):  # Skip on folders, these are usually duplicates
+            return
         self.logger.info('REBUILDING SITE (from {0})'.format(event.src_path))
         p = subprocess.Popen(self.cmd_arguments, stderr=subprocess.PIPE)
         error = p.stderr.read()


Test patch: