On 04/15/2013 05:01 AM, Gene Czarcinski wrote: > On 04/14/2013 07:36 PM, Gene Czarcinski wrote: >> On 04/14/2013 02:35 PM, Cole Robinson wrote: >>> On 04/13/2013 05:42 PM, Gene Czarcinski wrote: >>>> 1. The added suffix is in the form YYYYMMDD and that is all. >>>> >>>> 2. Code is added to classes my_sdist and my_rpm to check and >>>> see is a snapshot id is requested (--snapshot) and, if >>>> requested, to append the id to the value of cliconfig.__version__ >>>> >>>> 3. The added suffix only applies to the name of the sdist-tarball >>>> and the rpm spec file it includes ... the "internal" version >>>> remains unchanged. >>>> . >>>> Signed-off-by: Gene Czarcinski <gene@xxxxxxxxx> >>>> --- >>>> setup.py | 33 +++++++++++++++++++++++++++++---- >>>> virtcli/cliconfig.py | 2 ++ >>>> 2 files changed, 31 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/setup.py b/setup.py >>>> index aa712c2..ace1c3e 100644 >>>> --- a/setup.py >>>> +++ b/setup.py >>>> @@ -5,6 +5,7 @@ import fnmatch >>>> import os >>>> import sys >>>> import unittest >>>> +from datetime import date >>>> from distutils.core import Command, setup >>>> from distutils.command.sdist import sdist >>>> @@ -20,6 +21,10 @@ from DistUtilsExtra.command.build_icons import build_icons >>>> from virtcli import cliconfig >>>> +sdist.user_options.insert(0, ("snapshot", None, >>>> + "add snapshot id to version")) >>>> +sdist.boolean_options.insert(0, "snapshot") >>>> + >>> Why do it like this and not just add user_options to the my_sdist definition? >>> Look at the configure example that you edited in the previous patch. >> What you say here makes sense. Unfortunately, it does not work for me ... >> maybe I have the reverse midas touch ;( >> >> I need to specify the user_option =[] for rpm but it is subclassed off >> Command. And this should work because I am really doing the snapshot append >> based on the setting of cliconfig.__snapshot__ > > OK, I came up with a whole different kind of kludge. Lets see if this appeals > more that the previous kluge. > > 1. rename "my_sdist" to "my_sdist_auto" and add: > "sdist_auto": my_dist_auto > to th cmdclass list. > > Remove the code which inserted the entry into sdist's user_options list. > Don't do anything with checking for options and just add the snapshot suffix > depending on the setting of cliconfig.__snapshot__. > > Change "rpm" to do: > self.run_command('sdist_auto') > > Now, create a new "my_sdist" class definition which looks like the definition > for class "my_rpm" except for the name and the running of rpmbuild. > > This has been tested and works. Which kluidge do you want me to go with? > > 1 - modifiies sdist's user_options list > > 2 - creates a front-end which handles the --snapshot or -s options and a > back-end which does the real sdist work. > > Right now, I would have to flip a coin to choose although #2 has a slight edge > since it is my latest approach. > Ah sorry for misleading, indeed this is a bit tricky since sdist_auto is already a custom command and provides its own user_options. There's already an example of you what you want to do in setup.py: see TestBaseCommand (this is sdist_auto) and TestCommand (this is my_sdist). Then just override set 'sdist': my_sdist in the command map. - Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list