=== modified file 'dist/makedist' --- dist/makedist 2015-12-23 15:37:06 +0000 +++ dist/makedist 2016-02-21 16:30:19 +0000 @@ -25,8 +25,7 @@ import shutil import time import sys -from subprocess import Popen, PIPE, STDOUT -sys.path.insert(0, os.path.abspath("./")) +import subprocess from duplicity import util @@ -58,25 +57,24 @@ tardir = "duplicity-%s" % Version tarfile = "duplicity-%s.tar.gz" % Version try: - prog = util.which('rm') - p = Popen([prog, "-r", "-f", tardir], # @UnusedVariable - stdout=PIPE, stderr=STDOUT) - except Exception as e: # @UnusedVariable - pass - - # tardir contains the entire versioned release - prog = util.which('bzr') - p = Popen([prog, "export", tardir], - stdout=PIPE, stderr=STDOUT) - if p.returncode: - prog = util.which('git') - p1 = Popen([prog, "archive", "master"], - stdout=PIPE, stderr=STDOUT) - prog = util.which('tar') - p2 = Popen([prog, "-x", "-C", tardir], - stdin=p1.stdout, stdout=PIPE, stderr=STDOUT) - p1.stdout.close() - assert p2.returncode == 0, "git archive failed" + os.lstat(tardir) + os.system("rm -rf " + tardir) + except OSError: pass + + # tarball contains the entire versioned release + os.mkdir(tardir) + bzr = subprocess.Popen(["bzr", "ls", "-RV", "."], stdout=subprocess.PIPE) + testfiles = bzr.communicate()[0].split() + if len(testfiles) == 0: + git = subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE) + testfiles = git.communicate()[0].split() + + for filename in testfiles: + if os.path.isdir(filename): + os.mkdir(os.path.join(tardir, filename)) + else: + assert not os.system("cp --parents %s %s" % + (filename, tardir)), filename # msgfmt the translation files that we have for release assert not os.system("cd po && ./update-pot")