[Distutils] Weird PyPI Behavior

Phillip J. Eby pje at telecommunity.com
Thu Jun 29 22:42:06 CEST 2006


At 06:19 AM 6/29/2006 -0400, Jim Fulton wrote:
>1. If I'm going to edit setup.cfg, I might as well edit setup.py

Note that you needn't edit anything if you use the --tag-build option, e.g.:

     python setup.py egg_info --tag-build=snap3 register sdist bdist_egg upload

Assuming that setup.cfg normally contains:

    [egg_info]
    tag_build=dev

and you're not using tag-svn-revision by default.

In a future version of setuptools (maybe 0.6c1), there'll also be a command 
line option to turn *off* --tag-svn-revision.


>2. A reason I want to automate this is a feat that I'll forget to
>edit setup.py
>     or setup.cfg and overrite existing releases (or fail to do an
>update without
>     realizing it because the existing release doesn't get overwritten.
>
>Another issue is that I see us moving toward lots of fairly fine-grained
>packages and I want to keep the ceremony pretty low.

Yes, I once forgot to do this for setuptools itself, which is why I want 
options to remove the tags, then I can just add those notes to my release 
script.

However, I also have an automated tool to do version edits across many 
files in a project.  A simple ZConfig-based file describes what version 
numbers appear in what formats in what files, and is made executable via a 
#! line that runs a Python program that accepts various version-changing 
commands.  I can run "./version incr build" to bump from 0.6a1 to 0.6a2, 
for example, or './version incr minor' to bump from 0.6 to 0.7.  The tool 
then edits the relevant .py and .txt files, including setup.py itself.

Here's the 'version' script for setuptools; it might give you some ideas 
for making a similar tool for Zope projects.  You'll notice that it also 
edits my release.sh script, so that it knows what files it will be 
uploading to various servers...


#!/usr/local/bin/invoke /usr/local/bin/c6peak version-config

# This is a PEAK 'version' tool configuration file, that's
# also executable.  PJE uses it to bump version numbers in
# the various parts of the project without having to edit them
# by hand.  The current version is stored in the version.dat
# file.

# These are not the droids you're looking for.  You can go on
# about your business...

<Scheme default>
     DefaultFormat full
     part major
     part minor
     part status choice alpha beta "release candidate" final
     part build
     part date   timestamp

     <Formats>
     trailer   remap status "a%(build)s" "b%(build)s" "c%(build)s" 
"%(dot-maint)s"
     dot-maint optional build ".%(build)s"
     full      "%(major)s.%(minor)s %(status)s %(build)s"
     short     "%(major)s.%(minor)s%(trailer)s"
     </Formats>
</Scheme>

<Module>
     Name setuptools

     <Edit>
     File setup.py
     File ez_setup.py
     Match 'VERSION = "%(short)s"'
     </Edit>

     <Edit>
     File release.sh
     Match 'VERSION="%(short)s"'
     </Edit>

     <Edit>
     File setuptools/__init__.py
     Match "__version__ = '%(short)s'"
     </Edit>

</Module>



More information about the Distutils-SIG mailing list