3

We are deploying Plone add-ons as development eggs with buildout. The eggs are pushed to the production as source code checkouts using Mr. Developer buildout recipe and .egg packaging is not done in any point.

What would be best way to automatically update setup.py version stamp on every SVN commit to SVN release number or timestamp? This would give some quick info of tracking of different packages.

Distutils seem to offer some kind of magic version stamping mechanism, but I did not found any reference documentation how this should be used.

1

3 Answers 3

6

Add something like this in setup.cfg:

[egg_info]
tag_build = .dev
tag_svn_revision = 1

This only works for subversion of course; not sure if there are alternatives for other vcs. This file may still be added by default by some of the ZopeSkel templates. Some plone packages have it too; Wichert Akkerman is/was a fan of it.

Note that you do need to run bin/buildout or python setup.py egg_info every time to commit something, else the version info in the egg-info directory is not updated.

Sign up to request clarification or add additional context in comments.

1 Comment

Watch out, though, when releasing the package to pypi if you use this method. Don't forget to remove the lines from setup.cfg before releasing. There are too many mypackage-1.2-r1234.tar.gz packages...
1

You can use simply the SVN Keywords, like

__version__ = "$Rev:$"

SVN automatically changes with this keyword the version on every filechange respectively commit.

2 Comments

This will work fine for every commit to setup.py (assuming you put this line into setup.py). It won't update itself when you commit another file.
1 - Use correct SVN-keyword, for revision it's $Revision$, not your scrap 2 - expanded revision keyword isn't pure numeric revision only, it seems like such $Revision: 1132 $ and require post-processing 3 - Keyword show file's last-change revision, not repo-wide last-commit revision. Bad, you must redone your homework and RTFM
0

What would be best way to automatically update setup.py version stamp on every SVN commit to SVN release number or timestamp?

If

  • build process can execute some actions (I'm too lazy to read buildout recipe)
  • using additional Windows-only tools isn't strong "no-no" for you

you can consider to use SubWCRev cli-tool from TortoiseSVN package. It (slightly) change current workflow:

  • instead of real setup.py repository store template of setup.py, where dynamic part of data replaced by SubWCRev-keywords (they can handle revision, date in free form)
  • Every build-process have to regenerate actual setup.py by calling subwcrev against (local) working copy with predefined setup-template

3 Comments

The toolchain was explained in the question and it is not Windows based toolchain, luckily.
"using Mr. Developer buildout recipe" tells me nothing, BTW
Well then you might not be part of the audience who the question was targeted, but thank you for the suggestion anyway :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.