# HG changeset patch # User Paul Boddie # Date 1273331204 -7200 # Node ID 92d47a4aa49c49434463bfef8c26e8ac05f26e64 # Parent 4e672de9a37375a9f7d409cd5e0554b6a8a2244d Added support for installing from a Mercurial checkout (at least with 1.9.x era sources). diff -r 4e672de9a373 -r 92d47a4aa49c moinsetup.py --- a/moinsetup.py Tue May 04 00:25:24 2010 +0200 +++ b/moinsetup.py Sat May 08 17:06:44 2010 +0200 @@ -129,17 +129,27 @@ this_dir = os.getcwd() os.chdir(self.moin_distribution) - f = open("PKG-INFO") try: - for line in f.xreadlines(): - columns = line.split() - if columns[0] == "Version:": - return columns[1] + try: + f = open("PKG-INFO") + try: + for line in f.xreadlines(): + columns = line.split() + if columns[0] == "Version:": + return columns[1] + + return None - return None + finally: + f.close() + except IOError: + f = os.popen("%s -c 'from MoinMoin.version import release; print release'" % sys.executable) + try: + return f.read() + finally: + f.close() finally: - f.close() os.chdir(this_dir) def setup(self): @@ -186,7 +196,17 @@ status("Installing data and underlay in %s..." % self.conf_dir) for d in ("data", "underlay"): - shutil.copytree(join(self.moin_distribution, "wiki", d), join(self.conf_dir, d)) + source = join(self.moin_distribution, "wiki", d) + source_tar = source + os.path.extsep + "tar" + d_tar = source + os.path.extsep + "tar" + + if os.path.exists(source): + shutil.copytree(source, join(self.conf_dir, d)) + elif os.path.exists(source_tar): + shutil.copy(source_tar, self.conf_dir) + os.system("tar xf %s -C %s" % (d_tar, self.conf_dir)) + else: + status("Could not copy %s into installed Wiki." % d) def configure_moin(self):