viff

changeset 1099:cc706ddd9376

Use Mercurial via command line. The use of Mercurial through its API was a violation of its license since we were using GPL code from a LGPL program. Interfacing through the command line is the officially encouraged way for non-GPL programs to use Mercurial.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 04 Feb 2009 23:40:56 +0100
parents 54a68af0a945
children e810a006c2bf
files setup.py
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line diff
     1.1 --- a/setup.py	Wed Feb 04 23:06:07 2009 +0100
     1.2 +++ b/setup.py	Wed Feb 04 23:40:56 2009 +0100
     1.3 @@ -4,7 +4,7 @@
     1.4  # For a local install into ~/opt, use:  python setup.py --home=~/opt
     1.5  # For more options, use:                python setup.py --help
     1.6  
     1.7 -# Copyright 2007, 2008 VIFF Development Team.
     1.8 +# Copyright 2007, 2008, 2009 VIFF Development Team.
     1.9  #
    1.10  # This file is part of VIFF, the Virtual Ideal Functionality Framework.
    1.11  #
    1.12 @@ -33,22 +33,22 @@
    1.13  class hg_sdist(sdist):
    1.14      def get_file_list(self):
    1.15          try:
    1.16 -            # Attempt the import here so that users can run the other
    1.17 -            # Distutils commands without needing Mercurial.
    1.18 -            from mercurial import hg
    1.19 -        except ImportError:
    1.20              from distutils.errors import DistutilsModuleError
    1.21 -            raise DistutilsModuleError("could not import mercurial")
    1.22 +            import subprocess
    1.23 +            p = subprocess.Popen(['hg', 'manifest'], stdout=subprocess.PIPE)
    1.24 +            exitcode = p.wait()
    1.25 +            if exitcode != 0:
    1.26 +                raise DistutilsModuleError("Mercurial exited with non-zero "
    1.27 +                                           "exit code: %d" % exitcode)
    1.28 +            files = p.stdout.read().strip().split('\n')
    1.29  
    1.30 -        repo = hg.repository(None)
    1.31 -        changeset = repo.changectx(None)
    1.32 -        files = changeset.manifest().keys()
    1.33 -
    1.34 -        # Add the files *before* the normal manifest magic is done.
    1.35 -        # That allows the manifest template to exclude some files
    1.36 -        # tracked by hg and to include others.
    1.37 -        self.filelist.extend(files)
    1.38 -        sdist.get_file_list(self)
    1.39 +            # Add the files *before* the normal manifest magic is
    1.40 +            # done. That allows the manifest template to exclude some
    1.41 +            # files tracked by hg and to include others.
    1.42 +            self.filelist.extend(files)
    1.43 +            sdist.get_file_list(self)
    1.44 +        except OSError, e:
    1.45 +            raise DistutilsModuleError("could not execute Mercurial: %s" % e)
    1.46  
    1.47  setup(name='viff',
    1.48        version=viff.__version__,