moinsetup

Changeset

5:92d47a4aa49c
2010-05-08 Paul Boddie raw files shortlog changelog graph Added support for installing from a Mercurial checkout (at least with 1.9.x era sources).
moinsetup.py (file)
     1.1 --- a/moinsetup.py	Tue May 04 00:25:24 2010 +0200
     1.2 +++ b/moinsetup.py	Sat May 08 17:06:44 2010 +0200
     1.3 @@ -129,17 +129,27 @@
     1.4          this_dir = os.getcwd()
     1.5          os.chdir(self.moin_distribution)
     1.6  
     1.7 -        f = open("PKG-INFO")
     1.8          try:
     1.9 -            for line in f.xreadlines():
    1.10 -                columns = line.split()
    1.11 -                if columns[0] == "Version:":
    1.12 -                    return columns[1]
    1.13 +            try:
    1.14 +                f = open("PKG-INFO")
    1.15 +                try:
    1.16 +                    for line in f.xreadlines():
    1.17 +                        columns = line.split()
    1.18 +                        if columns[0] == "Version:":
    1.19 +                            return columns[1]
    1.20 +
    1.21 +                    return None
    1.22  
    1.23 -            return None
    1.24 +                finally:
    1.25 +                    f.close()
    1.26  
    1.27 +            except IOError:
    1.28 +                f = os.popen("%s -c 'from MoinMoin.version import release; print release'" % sys.executable)
    1.29 +                try:
    1.30 +                    return f.read()
    1.31 +                finally:
    1.32 +                    f.close()
    1.33          finally:
    1.34 -            f.close()
    1.35              os.chdir(this_dir)
    1.36  
    1.37      def setup(self):
    1.38 @@ -186,7 +196,17 @@
    1.39          status("Installing data and underlay in %s..." % self.conf_dir)
    1.40  
    1.41          for d in ("data", "underlay"):
    1.42 -            shutil.copytree(join(self.moin_distribution, "wiki", d), join(self.conf_dir, d))
    1.43 +            source = join(self.moin_distribution, "wiki", d)
    1.44 +            source_tar = source + os.path.extsep + "tar"
    1.45 +            d_tar = source + os.path.extsep + "tar"
    1.46 +
    1.47 +            if os.path.exists(source):
    1.48 +                shutil.copytree(source, join(self.conf_dir, d))
    1.49 +            elif os.path.exists(source_tar):
    1.50 +                shutil.copy(source_tar, self.conf_dir)
    1.51 +                os.system("tar xf %s -C %s" % (d_tar, self.conf_dir))
    1.52 +            else:
    1.53 +                status("Could not copy %s into installed Wiki." % d)
    1.54  
    1.55      def configure_moin(self):
    1.56