[virt-tools-list] [PATCH v6 2/5] automate @VERSION@ in virt-manager.spec

Cole Robinson crobinso at redhat.com
Sun Apr 14 18:32:45 UTC 2013


On 04/13/2013 05:42 PM, Gene Czarcinski wrote:
> This update renames virt-manager.spec to be
> virt-manager.spec.in and changes the version-id to
> @VERSION@ ... setup.py is modified to copy the
> virt-manager-spec.in file to virt-manager.spec and
> replace @VERSION@ with the current/actual version id.
> 
> .gitignore is updated to ignore virt-manager.spec
> .

Something is strange with this. When I download this email and try to 'git am'
it, git complains like:

fatal: cannot convert from y to UTF-8

If I edit the mail and s/charset=y/charset=UTF-8/ it works. Is it prompting
you about UTF-8 but you are entering 'y' rather than hitting enter? That's my
guess anyways.





> Signed-off-by: Gene Czarcinski <gene at czarc.net>
> ---
>  .gitignore           |   1 +
>  setup.py             |  17 +-
>  virt-manager.spec    | 612 ---------------------------------------------------
>  virt-manager.spec.in | 612 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 629 insertions(+), 613 deletions(-)
>  delete mode 100644 virt-manager.spec
>  create mode 100644 virt-manager.spec.in
> 
> diff --git a/.gitignore b/.gitignore
> index e65afd5..707b60e 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -12,4 +12,5 @@
>  /man/virt-convert.1
>  /man/virt-image.5
>  
> +/virt-manager.spec
>  /virtcli/cli.cfg
> diff --git a/setup.py b/setup.py
> index cc0de88..317f84d 100644
> --- a/setup.py
> +++ b/setup.py
> @@ -7,6 +7,7 @@ import sys
>  import unittest
>  
>  from distutils.core import Command, setup
> +from distutils.command.sdist import sdist
>  from distutils.command.install import install
>  from distutils.command.install_egg_info import install_egg_info
>  from distutils.sysconfig import get_config_var
> @@ -177,6 +178,20 @@ class my_install(install):
>  
>          install.finalize_options(self)
>  
> +class my_sdist(sdist_auto, sdist):

sdist_auto likely already extends sdist. I think you can just do

class my_sdist(sdist_auto)

> +    user_option = []
> +    description = "Update virt-manager.spec; build sdist-tarball."
> +
> +    def run(self):
> +        ver = cliconfig.__version__
> +        f1 = open('virt-manager.spec.in', 'r')
> +        f2 = open('virt-manager.spec', 'w')
> +        for line in f1:
> +            f2.write(line.replace('@VERSION@', ver))
> +        f1.close()
> +        f2.close()
> +        sdist.run(self)
> +

Then here do sdist_auto.run(self)

Thanks,
Cole




More information about the virt-tools-list mailing list