[Distutils] 'sdist' command extension that supports svk

Matthew Scott mscott at goldenspud.com
Sat Oct 1 17:44:08 CEST 2005


It's not pretty, and it requires the 'py' lib, but it works for those
using SVK instead of Subversion  :)


from setuptools.command.sdist import sdist as _sdist

class sdist(_sdist):

    def add_defaults(self):
        _sdist.add_defaults(self)
        try:
            import py
        except ImportError:
            return
        try:
            svk = py.path.local.sysfind('svk').sysexec
        except py.error.ENOENT:
            return
        try:
            info = svk('info')
        except py.process.cmdexec.Error:
            return
        depot = None
        for line in info.splitlines():
            if line.startswith('Depot Path'):
                depot = line.split(': ')[-1]
                break
        if not depot:
            return
        start = len(depot) + 1
        paths = [path[start:] for path in svk('ls', '-fR').splitlines()]
        self.filelist.extend(paths)


--
Matthew R. Scott


More information about the Distutils-SIG mailing list