Bump to version 0.6.2 Changes since 0.6.1: * Fallback to directory name if project.name isn't set * Require project.vcs * Convert parser access to use the mapping protocol * README: Switch from {section}/{option} to {section}.{option} * setup.py: Mention Python 3.4 compatibility
project: Fallback to directory name if project/name isn't set I recommend folks set this explicitly, but Greg Wilson wanted a way for folks to use update-copyright without having to tweak this name after forking [1]. The approach I've used here isn't the same as the one discussed in that issue (using the name of the upstream Git repository), but I think it's a better choice. Pros and cons: + Simple, VCS-agnostic implementation + Doesn't make assumptions about the upstream repository naming - Assumes folks name their local repository appropriately - Won't handle several projects stored in the same Git repository For example, if you have a branch for project-a and another for project-b that are both in your local project-a repository, you'll have to explicitly set project.name in the project-b branch's .update-copyright.conf. [1]: https://github.com/swcarpentry/lesson-template/pull/197#discussion_r26456407
project: Require project/vcs We use the configured VCS for the author list and per-file updates, so there's nothing we can do if the user hasn't set it. Instead of crashing with: Traceback (most recent call last): File "./bin/update-copyright.py", line 80, in <module> project.update_authors(dry_run=args.dry_run) File "/.../update_copyright/project.py", line 162, in update_authors authors = self._vcs.authors() AttributeError: 'NoneType' object has no attribute 'authors' Die earlier with: Traceback (most recent call last): File "./bin/update-copyright.py", line 78, in <module> project.load_config(open(args.config, 'r')) File "/home/wking/src/update-copyright/update_copyright/project.py", line 66, in load_config loader(parser=parser) File "/home/wking/src/update-copyright/update_copyright/project.py", line 89, in _load_project_conf raise NotImplementedError('vcs: {}'.format(vcs)) NotImplementedError: vcs: None We may want to add some auto-detection logic here in the future.
project: Convert parser access to use the mapping protocol Use the more dict-like access [1] instead of the API that's specific to ConfigParser. This is likely to be more familiar to future developers, and reduces the cognitive load of dealing with another API. The only place I couldn't drop the old API was in load_config, where I kept parser.sections() [2] because using parser.keys() was giving me: AttributeError: 'Project' object has no attribute '_load_DEFAULT_conf' The: try: section = parser['...'] except KeyError: section = {} blocks are also more awkward than a dicts: section = parser.get('...', {}) but we can't use that API because it's clobbered by ConfigParser.get(section, option, ...) [3]. Maybe someday they'll support: section = parser.get('...', default={}) (or with 'fallback' instead of 'default'). [1]: https://docs.python.org/3/library/configparser.html#mapping-protocol-access [2]: https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.sections [3]: https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get
README: update to pipe separators This brings the config file up to speed with the following update-copyright commit (which landed in 0.5): commit 3c68a1a48419d8b2bbc2ce0e7f1700b996ec30e9 Author: W. Trevor King <wking@tremily.us> Date: Fri Oct 19 21:52:48 2012 -0400 project: for consistency, also separate ignored paths with pipes
Bump to version 0.6 Changes since 0.5: * Dropped Bazaar support. * Fixed Mercurial support for Python 3 (by shelling out to hg). * Adjusted date ranges so the final date is the last year a file was patched, and not the current year. This avoids bumping copyright years when there were no changes.
vcs.mercurial: Shell out to hg instead of using the mercurial package Mercurial doesn't have Python 3 support, and has no plans for adding it in the near future [1]. It's a pretty painless conversion to shell out instead (as we already do for Git), so go that route instead. [1]: http://mercurial.selenic.com/wiki/SupportedPythonVersions#Python_3.x_support
vcs.bazaar: Remove Bazaar support As of 2013-05-19, Bazaar had no Python 3 compatibility, and no likelyhood of adding it in the near future [1]. This module could be ported to use the command line client (like Git), but I also haven't seen a Bazaar repository in a while ;). [1]: https://answers.launchpad.net/bzr/+question/229048#comment-0
project: Replace original_year and final_year with years Rather than automatically bumping the final year to the current year, only bump to the last year for which a file was changed. I've kept the 'first-last' syntax, but update_copyright.utils.copyright_string is not the only place you have to edit if you prefer to list them all explicitly: Copyright (C) year-1, year-2, ..., year-n A. U. Thor ...