The idea to put gentoolkit's version in the /etc folder came from /etc/gentoo-release, but I release now it's not the best location because: 1) it's not meant to be user-editable 2) the user will have to run dispatch-conf or etc-update after each update of gentoolkit, which is really unnecessary loki_val suggested putting it in /usr/share. If we did that, it'd be an easy switch, just change the location the ebuild writes to and change the filename that each script is reading from. A different idea is to use the Makefile to write the version to the files right before being tarred up, similar to what FuzzyRay already uses to set the version in setup.py. Something like: # Set python scripts' version sed -i "s/^__version__ = .*/__version__ = '$(VERSION)'/" setup.py bin/* pym/gentoolkit/equery/__init__.py # Set bash scripts' version sed -i "s/^PROGRAM_VERSION=.*/PROGRAM_VERSION="$(VERSION)"/" bin/euse To use that, we'd have to change VER to __version__ in setup.py (and there might have been a change in one other file). I personally think the Makefile version is the cleaner of the two, but it needs more modifications and it's needs testing from someone who can commit to svn so all their changes aren't reverted. :) Thoughts?
And you'd need to update what was reverted: svn revert setup.py bin/* pym/gentoolkit/equery/__init__.py
You'd also need to change VER = foo to __version__ = foo in setup.py. I'm actually kinda frustrated with the response I'm getting from python on this: I think having to jump through hoops or manually set version strings in multiple places is a violation of python philosophy, but distutils doesn't handle this for us, yet (and I've found threads requesting this feature from as far back as 2000: http://markmail.org/message/2scglmh7ckuee6fz ) Let's do this: Create a file named VERSION and a symlink VERSION.py containing only a quoted string with the version number in it. # echo '1.2.3.4' > VERSION && ln -s VERSION VERSION.py Then, in setup.py, near the top (__init__.py can use this method too if it's convenient.): # HACK to get version in a way that works in both bash and python from VERSION import __doc__ as __version__ Then install VERSION with the other files like README, AUTHORS, etc, and use that file for pulling version info. Doing this in make isn't quite as trivial. Although we could just do make VERSION=$(<VERSION) in the ebuild, or we could leave the VERSION out of the Makefile entirely.
Even better. Don't make the VERSION.py symlink, and instead do: execfile('VERSION') __version__ = __doc__ Also, for reading the VERSION in bash you'll need to strip out the quotes, either with parameter expansion: echo "${VERSION//'}" or by dropping them at read time: IFS="'" read _ VERSION _ < VERSION
If that VERSION file would get installed to /usr/share/gentoolkit/VERSION then that would be a fine solution. Also we could just not quote the version in VERSION and get it with VERSION=$(cat /path/to/VERSION) in bash and __version__ = open('/path/to/VERSION').read().strip() in python. I'm using something similar to that now.
Created attachment 191733 [details, diff] gentoolkit-VERSION.patch This patch sets up the repository to expect a VERSION file. Releases should have a specific version in this file. It doesn't really matter what is in the file in trunk, but for clarity's sake I think it should contain 9999, unquoted.
$ svn commit -m "Change /etc/gentoolkit-version to /usr/share/gentoolkit/VERSION" Sending gentoolkit/ChangeLog Sending gentoolkit/bin/eclean Sending gentoolkit/bin/epkginfo Sending gentoolkit/bin/euse Sending gentoolkit/bin/glsa-check Sending gentoolkit/pym/gentoolkit/equery/__init__.py Transmitting file data ...... Committed revision 651.
Released in gentoolkit-0.3.0_rc7