moinsetup

Changeset

42:1afd3bcd9c80
2011-09-14 Paul Boddie raw files shortlog changelog graph Introduced a special site-packages location setting where libraries are installed outside the prefix hierarchy. Added more specific error messages when unsuitable or insufficient settings are given. Added an example configuration file for Debian-compatible systems.
moinsetup.cfg (file) moinsetup.cfg.debian (file) moinsetup.py (file)
     1.1 --- a/moinsetup.cfg	Tue Sep 13 00:07:23 2011 +0200
     1.2 +++ b/moinsetup.cfg	Wed Sep 14 00:11:35 2011 +0200
     1.3 @@ -2,6 +2,7 @@
     1.4  moin_distribution = moin-1.9-hg
     1.5  moin_data         =
     1.6  prefix            = moin
     1.7 +site_packages     =
     1.8  web_app_dir       = webapps
     1.9  web_static_dir    =
    1.10  web_site_dir      = sites-available
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/moinsetup.cfg.debian	Wed Sep 14 00:11:35 2011 +0200
     2.3 @@ -0,0 +1,18 @@
     2.4 +[installation]
     2.5 +moin_distribution =
     2.6 +moin_data         = /usr/share/moin
     2.7 +prefix            = /usr
     2.8 +site_packages     = /var/lib/python-support/python2.5
     2.9 +web_app_dir       = /var/www/mywiki
    2.10 +web_static_dir    =
    2.11 +web_site_dir      = /etc/apache2/sites-available
    2.12 +
    2.13 +[site]
    2.14 +common_dir        = /var/lib/mywiki
    2.15 +farm_config       = /etc/moin/farmconfig.py
    2.16 +site_config       = /etc/moin/mywiki.py
    2.17 +url_path          = /mywiki
    2.18 +superuser         = AdminUser
    2.19 +site_name         = My Wiki
    2.20 +front_page_name   = FrontPage
    2.21 +theme_default     = modern
     3.1 --- a/moinsetup.py	Tue Sep 13 00:07:23 2011 +0200
     3.2 +++ b/moinsetup.py	Wed Sep 14 00:11:35 2011 +0200
     3.3 @@ -327,10 +327,10 @@
     3.4      theme_master = "modernized"
     3.5      extra_theme_css_files = ["SlideShow.css"]
     3.6  
     3.7 -    def __init__(self, moin_distribution, moin_data, prefix, web_app_dir,
     3.8 -        common_dir, url_path, superuser, site_name, front_page_name,
     3.9 -        web_site_dir=None, web_static_dir=None, farm_config=None,
    3.10 -        site_config=None, theme_default=None):
    3.11 +    def __init__(self, moin_distribution=None, moin_data=None, prefix=None,
    3.12 +        site_packages=None, web_app_dir=None, web_static_dir=None, web_site_dir=None,
    3.13 +        common_dir=None, farm_config=None, site_config=None, url_path=None,
    3.14 +        superuser=None, site_name=None, front_page_name=None, theme_default=None):
    3.15  
    3.16          """
    3.17          Initialise a Wiki installation using the following:
    3.18 @@ -362,6 +362,9 @@
    3.19                                  'common_dir' setting)
    3.20            * site_config       - optional: a specific configuration file location
    3.21                                  (overrides the 'common_dir' setting)
    3.22 +          * site_packages     - optional: the location of the Python
    3.23 +                                site-packages directory if outside the 'prefix'
    3.24 +                                (overrides the path calculated using 'prefix')
    3.25            * theme_default     - optional: the default theme (such as modern)
    3.26          """
    3.27  
    3.28 @@ -394,7 +397,8 @@
    3.29  
    3.30          # Define the place where the MoinMoin package will actually reside.
    3.31  
    3.32 -        self.prefix_site_packages = join(self.prefix, "lib", "python%s.%s" % sys.version_info[:2], "site-packages")
    3.33 +        self.prefix_site_packages = site_packages or \
    3.34 +            join(self.prefix, "lib", "python%s.%s" % sys.version_info[:2], "site-packages")
    3.35  
    3.36          # Find the version.
    3.37  
    3.38 @@ -1249,7 +1253,8 @@
    3.39              os.environ["PYTHONPATH"] = self.prefix_site_packages + ":" + self.conf_dir
    3.40  
    3.41          installer = join(self.prefix_site_packages, "MoinMoin", "packages.py")
    3.42 -        os.system("python %s i %s" % (installer, package_filename))
    3.43 +        cmd = "python %s i %s" % (installer, package_filename)
    3.44 +        os.system(cmd)
    3.45  
    3.46          if path:
    3.47              os.environ["PYTHONPATH"] = path
    3.48 @@ -1303,7 +1308,9 @@
    3.49  
    3.50          installation = Installation(**config_arguments)
    3.51  
    3.52 -    except TypeError:
    3.53 +    except TypeError, exc:
    3.54 +        print exc.args[0]
    3.55 +        print
    3.56          print "Configuration settings:"
    3.57          print
    3.58          print Installation.__init__.__doc__
    3.59 @@ -1321,6 +1328,8 @@
    3.60      try:
    3.61          method(*method_arguments)
    3.62      except TypeError:
    3.63 +        print exc.args[0]
    3.64 +        print
    3.65          print "Method documentation:"
    3.66          print
    3.67          print method.__doc__