moinsetup

Changeset

13:4cca4300a8eb
2010-05-25 Paul Boddie raw files shortlog changelog graph Split the script installation/configuration into separate methods covering each kind of script. Tidied up site-packages references.
moinsetup.py (file)
     1.1 --- a/moinsetup.py	Mon May 24 22:32:41 2010 +0200
     1.2 +++ b/moinsetup.py	Tue May 25 00:40:48 2010 +0200
     1.3 @@ -274,7 +274,8 @@
     1.4  
     1.5          self.install_data()
     1.6          self.configure_moin()
     1.7 -        self.edit_moin_scripts()
     1.8 +        self.edit_moin_script()
     1.9 +        self.edit_moin_web_script()
    1.10          self.add_superuser()
    1.11          self.make_site_files()
    1.12          self.make_post_install_script()
    1.13 @@ -384,21 +385,23 @@
    1.14          if self.theme_default is not None:
    1.15              wikiconfig.set("theme_default", self.theme_default)
    1.16  
    1.17 -    def edit_moin_scripts(self):
    1.18 +    def edit_moin_script(self):
    1.19  
    1.20 -        "Edit the moin script and the CGI script."
    1.21 +        "Edit the moin script."
    1.22  
    1.23          moin_script = join(self.prefix, "bin", "moin")
    1.24 -        prefix_site_packages = join(self.prefix, "lib", "python%s.%s" % sys.version_info[:2], "site-packages")
    1.25  
    1.26          status("Editing moin script at %s..." % moin_script)
    1.27  
    1.28          s = readfile(moin_script)
    1.29 -        s = s.replace("#import sys", "import sys\nsys.path.insert(0, %r)" % prefix_site_packages)
    1.30 +        s = s.replace("#import sys", "import sys\nsys.path.insert(0, %r)" % self.prefix_site_packages)
    1.31  
    1.32          writefile(moin_script, s)
    1.33  
    1.34 -        # Edit and install CGI script.
    1.35 +    def edit_moin_web_script(self):
    1.36 +
    1.37 +        "Edit and install CGI script."
    1.38 +
    1.39          # NOTE: CGI only so far.
    1.40          # NOTE: Permissions should be checked.
    1.41  
    1.42 @@ -408,7 +411,7 @@
    1.43          status("Editing moin.cgi script from %s..." % moin_cgi)
    1.44  
    1.45          s = readfile(moin_cgi)
    1.46 -        s = moin_cgi_prefix.sub("sys.path.insert(0, %r)" % prefix_site_packages, s)
    1.47 +        s = moin_cgi_prefix.sub("sys.path.insert(0, %r)" % self.prefix_site_packages, s)
    1.48          s = moin_cgi_wikiconfig.sub("sys.path.insert(0, %r)" % self.conf_dir, s)
    1.49  
    1.50          writefile(moin_cgi_installed, s)