version in python package distributions, argh

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

version in python package distributions, argh

Ian Zimmerman-2

How do people manage the version number in the setup.py file of your
distributions?  I have distributions that contain exectuable scripts.  I
like those scripts to have a -V or --version command line option like
other well behaved programs.  Unless I do something clever, this leads
to duplication of the version info in at least 2 places, with
predictable um, results.

So, I did try something clever:

from distutils.core import setup
import subprocess

sp = subprocess.Popen(['./hgit', '--version'], stdout=subprocess.PIPE)
vline = sp.stdout.read()
sp.wait()
prog, version = vline.strip().split()

setup (name = 'hgit',
       version = version,

...

only to discover that during installation from a source package the
script file is not necessarily executable, which will crash any
invocation of setup.py.

What other ways are there to solve this annoying situation?

--
Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
Rule 420: All persons more than eight miles high to leave the court.
_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: version in python package distributions, argh

Ryan Matthew Balfanz
I have to look at another project setup.py file everytime I make one, to remember how to do it. I've found the one for django-celery to be pretty good: https://github.com/ask/django-celery/blob/master/setup.py.

Hope it helps.

Cheers,
Ryan

On Sun, Jan 22, 2012 at 8:50 PM, Ian Zimmerman <[hidden email]> wrote:

How do people manage the version number in the setup.py file of your
distributions?  I have distributions that contain exectuable scripts.  I
like those scripts to have a -V or --version command line option like
other well behaved programs.  Unless I do something clever, this leads
to duplication of the version info in at least 2 places, with
predictable um, results.

So, I did try something clever:

from distutils.core import setup
import subprocess

sp = subprocess.Popen(['./hgit', '--version'], stdout=subprocess.PIPE)
vline = sp.stdout.read()
sp.wait()
prog, version = vline.strip().split()

setup (name = 'hgit',
      version = version,

...

only to discover that during installation from a source package the
script file is not necessarily executable, which will crash any
invocation of setup.py.

What other ways are there to solve this annoying situation?

--
Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
Rule 420: All persons more than eight miles high to leave the court.
_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies


_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: version in python package distributions, argh

Ian Zimmerman-2

Ryan> I have to look at another project setup.py file everytime I make
Ryan> one, to remember how to do it. I've found the one for
Ryan> django-celery to be pretty good:
Ryan> https://github.com/ask/django-celery/blob/master/setup.py.

Ryan> Hope it helps.

In a way it does :-/

It uses setuptools, not plain distutils.  I have been trying to not
depend on setuptools for some time.  Maybe it is time to give up.

--
Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
Rule 420: All persons more than eight miles high to leave the court.
_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies