restore write protection on directories

* @dagss originally put code in that didn't protect directories
* @certik introduced a non-portable fix to add directory protection
* I removed the non-portable code when introducing `develop` functionality.
  (see 9d9f0b728bfc88d4b435b691bd95e3171159f1af )

Now I'm re-adding portable directory protection to protect us from
further foot-shooting.

We also need to temporarily allow writing to the artifact directory
after it's been built to store things like the id and build log.  I've
added a context manager to file utils based on a suggestion by @dagss to
simplify this.
Update skeleton template to follow move to setuptools.
Merge pull request #227 from lanewittgen/master

Update skeleton template to follow move to setuptools.
Better Unicode handling

This fixes a long-standing issue on Cygwin where Unicode-encoded error
messages from stderr were unable to be written to the ASCII-encoded
build log.  The messages are now explicitly converted to ASCII with
untranslatable characters ignored.
Merge pull request #228 from hashdist/ahmadia/unicode_fixes

Better Unicode handling -- Fix #153
Handle case where encoding is not set
Merge pull request #229 from hashdist/ahmadia/fix_encoding_2

Handle case where encoding is not set
Improve support for hit develop -l copy

We use hit develop -l copy to build a complete profile in-place that is
suitable for archiving or redistribution.

This improves support for profiles that use launcher by silently
ignoring requests to launchify executables, and allowing copy requests
to work for directories as well.
Merge pull request #230 from hashdist/ahmadia/better_copy_support

Improve support for hit develop -l copy
Merge pull request #224 from hashdist/ahmadia/restore_path_protection

[WIP] restore write protection on directories