moinsetup

Changeset

48:61df4406786d
2011-09-25 Paul Boddie raw files shortlog changelog graph Added tests for the presence of resources to be moved in the target location, typically the case when a conf symbolic link points to the parent directory.
moinsetup.py (file)
     1.1 --- a/moinsetup.py	Sun Sep 18 21:37:22 2011 +0200
     1.2 +++ b/moinsetup.py	Sun Sep 25 22:01:59 2011 +0200
     1.3 @@ -1074,9 +1074,11 @@
     1.4          if exists(conf_dir):
     1.5              for filename in listdir(conf_dir):
     1.6                  pathname = join(conf_dir, filename)
     1.7 -                print "Move", filename, "from conf directory."
     1.8 -                if not test:
     1.9 -                    rename(pathname, join(self.common_dir, filename))
    1.10 +                target = join(self.common_dir, filename)
    1.11 +                if not exists(target):
    1.12 +                    print "Move", filename, "from conf directory."
    1.13 +                    if not test:
    1.14 +                        rename(pathname, target)
    1.15          else:
    1.16              print "No conf directory."
    1.17  
    1.18 @@ -1084,9 +1086,11 @@
    1.19          if exists(wikidata):
    1.20              htdocs = join(wikidata, "share", "moin", "htdocs")
    1.21              if exists(htdocs):
    1.22 -                print "Move htdocs from wikidata directory."
    1.23 -                if not test:
    1.24 -                    rename(htdocs, join(self.common_dir, "htdocs"))
    1.25 +                target = join(self.common_dir, "htdocs")
    1.26 +                if not exists(target):
    1.27 +                    print "Move htdocs from wikidata directory."
    1.28 +                    if not test:
    1.29 +                        rename(htdocs, target)
    1.30          else:
    1.31              print "No wikidata directory."
    1.32