1.1 --- a/moinsetup.py Wed Sep 14 00:11:35 2011 +0200
1.2 +++ b/moinsetup.py Thu Sep 15 23:57:53 2011 +0200
1.3 @@ -55,7 +55,7 @@
1.4 ScriptAlias %(url_path)s "%(web_app_dir)s/moin.cgi"
1.5 """
1.6
1.7 -apache_site_extra_moin18 = """
1.8 +apache_site_extra = """
1.9 Alias %(static_url_path)s "%(htdocs_dir)s/"
1.10 """
1.11
1.12 @@ -79,26 +79,26 @@
1.13
1.14 postsetup_setfacl = """#!/bin/sh
1.15
1.16 -find '%(conf_dir)s/data' -type f | xargs setfacl -m u:%(web_user)s:rw
1.17 -find '%(conf_dir)s/data' -type d | xargs setfacl -m u:%(web_user)s:rwx
1.18 -find '%(conf_dir)s/underlay' -type f | xargs setfacl -m u:%(web_user)s:rw
1.19 -find '%(conf_dir)s/underlay' -type d | xargs setfacl -m u:%(web_user)s:rwx
1.20 +find '%(common_dir)s/data' -type f | xargs setfacl -m u:%(web_user)s:rw
1.21 +find '%(common_dir)s/data' -type d | xargs setfacl -m u:%(web_user)s:rwx
1.22 +find '%(common_dir)s/underlay' -type f | xargs setfacl -m u:%(web_user)s:rw
1.23 +find '%(common_dir)s/underlay' -type d | xargs setfacl -m u:%(web_user)s:rwx
1.24 """
1.25
1.26 -postsetup_setfacl_moin18_extra = """
1.27 +postsetup_setfacl_extra = """
1.28 find '%(htdocs_dir)s' -type f | xargs setfacl -m u:%(web_user)s:r
1.29 find '%(htdocs_dir)s' -type d | xargs setfacl -m u:%(web_user)s:rx
1.30 """
1.31
1.32 postsetup_chown_chmod = """#!/bin/sh
1.33
1.34 -chown -R %(this_user)s.%(web_group)s '%(conf_dir)s/data'
1.35 -chown -R %(this_user)s.%(web_group)s '%(conf_dir)s/underlay'
1.36 -chmod -R g+w '%(conf_dir)s/data'
1.37 -chmod -R g+w '%(conf_dir)s/underlay'
1.38 +chown -R %(this_user)s.%(web_group)s '%(common_dir)s/data'
1.39 +chown -R %(this_user)s.%(web_group)s '%(common_dir)s/underlay'
1.40 +chmod -R g+w '%(common_dir)s/data'
1.41 +chmod -R g+w '%(common_dir)s/underlay'
1.42 """
1.43
1.44 -postsetup_chown_moin18_extra = """
1.45 +postsetup_chown_extra = """
1.46 chown -R %(this_user)s.%(web_group)s '%(htdocs_dir)s'
1.47 """
1.48
1.49 @@ -291,6 +291,7 @@
1.50 "setup_wiki",
1.51 "install_moin",
1.52 "install_data",
1.53 + "install_static_data",
1.54 "configure_moin",
1.55 "edit_moin_script",
1.56 "edit_moin_web_script",
1.57 @@ -327,51 +328,56 @@
1.58 theme_master = "modernized"
1.59 extra_theme_css_files = ["SlideShow.css"]
1.60
1.61 - def __init__(self, moin_distribution=None, moin_data=None, prefix=None,
1.62 + def __init__(self, moin_distribution=None, prefix=None,
1.63 site_packages=None, web_app_dir=None, web_static_dir=None, web_site_dir=None,
1.64 common_dir=None, farm_config=None, site_config=None, url_path=None,
1.65 - superuser=None, site_name=None, front_page_name=None, theme_default=None):
1.66 + superuser=None, site_name=None, site_identifier=None, front_page_name=None,
1.67 + theme_default=None):
1.68
1.69 """
1.70 - Initialise a Wiki installation using the following:
1.71 + Initialise a Wiki installation using the following installation
1.72 + settings:
1.73
1.74 * moin_distribution - the directory containing a MoinMoin source
1.75 - distribution
1.76 - * moin_data - the directory containing MoinMoin shared data
1.77 - (can be omitted if 'moin_distribution' is given)
1.78 + distribution (can be omitted)
1.79 * prefix - the installation prefix (equivalent to /usr)
1.80 + * site_packages - optional: the location of the Python
1.81 + site-packages directory if outside the 'prefix'
1.82 + (overrides the path calculated using 'prefix')
1.83 * web_app_dir - the directory where Web applications and scripts
1.84 reside (such as /home/www-user/cgi-bin)
1.85 + * web_static_dir - optional: the directory where static Web
1.86 + resources reside (such as /home/www-user/htdocs)
1.87 + * web_site_dir - optional: the directory where Web site
1.88 + definitions reside (such as
1.89 + /etc/apache2/sites-available)
1.90 +
1.91 + The following site settings are also applicable:
1.92 +
1.93 * common_dir - the directory where the Wiki configuration,
1.94 resources and instance will reside (such as
1.95 /home/www-user/mywiki)
1.96 + * farm_config - optional: any Wiki farm configuration file for
1.97 + multiple Wiki deployments (overrides the
1.98 + 'common_dir' setting)
1.99 + * site_config - optional: a specific configuration file location
1.100 + (overrides the 'common_dir' setting)
1.101 * url_path - the URL path at which the Wiki will be made
1.102 available (such as / or /mywiki)
1.103 * superuser - the name of the site's superuser (such as
1.104 "AdminUser")
1.105 * site_name - the name of the site (such as "My Wiki")
1.106 + * site_identifier - optional: an identifier used to refer to the
1.107 + site, typically derived from 'site_name'
1.108 * front_page_name - the front page name for the site (such as
1.109 "FrontPage" or a specific name for the site)
1.110 - * web_site_dir - optional: the directory where Web site
1.111 - definitions reside (such as
1.112 - /etc/apache2/sites-available)
1.113 - * web_static_dir - optional: the directory where static Web
1.114 - resources reside (such as /home/www-user/htdocs)
1.115 - * farm_config - optional: any Wiki farm configuration file for
1.116 - multiple Wiki deployments (overrides the
1.117 - 'common_dir' setting)
1.118 - * site_config - optional: a specific configuration file location
1.119 - (overrides the 'common_dir' setting)
1.120 - * site_packages - optional: the location of the Python
1.121 - site-packages directory if outside the 'prefix'
1.122 - (overrides the path calculated using 'prefix')
1.123 * theme_default - optional: the default theme (such as modern)
1.124 """
1.125
1.126 self.moin_distribution = moin_distribution
1.127 - self.moin_data = moin_data
1.128 self.superuser = superuser
1.129 self.site_name = site_name
1.130 + self.site_identifier = site_identifier or site_name.replace(" ", "").lower()
1.131 self.front_page_name = front_page_name
1.132 self.farm_config = farm_config
1.133 self.site_config = site_config
1.134 @@ -379,11 +385,17 @@
1.135
1.136 # NOTE: Support the detection of the Apache sites directory.
1.137
1.138 - self.prefix, self.web_app_dir, self.web_site_dir, self.web_static_dir, self.common_dir = \
1.139 - map(self._get_abspath, (prefix, web_app_dir, web_site_dir, web_static_dir, common_dir))
1.140 + self.prefix, self.site_packages, self.web_app_dir, self.web_site_dir, self.web_static_dir, self.common_dir = \
1.141 + map(self._get_abspath, (prefix, site_packages, web_app_dir, web_site_dir, web_static_dir, common_dir))
1.142 +
1.143 + if not self.web_app_dir:
1.144 + raise TypeError, "The 'web_app_dir' setting must be specified."
1.145
1.146 # Strip any trailing "/" from the URL path.
1.147
1.148 + if not url_path:
1.149 + raise TypeError, "The 'url_path' setting must be specified."
1.150 +
1.151 if url_path != "/" and url_path.endswith("/"):
1.152 self.url_path = url_path[:-1]
1.153 else:
1.154 @@ -392,12 +404,15 @@
1.155 # Define and create specific directories.
1.156 # Here are the configuration and actual Wiki data directories.
1.157
1.158 - self.conf_dir = join(self.common_dir, "conf")
1.159 - self.instance_dir = join(self.common_dir, "wikidata")
1.160 + if not self.common_dir:
1.161 + raise TypeError, "The 'common_dir' setting must be specified."
1.162
1.163 # Define the place where the MoinMoin package will actually reside.
1.164
1.165 - self.prefix_site_packages = site_packages or \
1.166 + if not self.prefix and not self.site_packages:
1.167 + raise TypeError, "Either the 'prefix' or the 'site_packages' setting must be specified."
1.168 +
1.169 + self.prefix_site_packages = self.site_packages or \
1.170 join(self.prefix, "lib", "python%s.%s" % sys.version_info[:2], "site-packages")
1.171
1.172 # Find the version.
1.173 @@ -405,81 +420,84 @@
1.174 self.moin_version = self.get_moin_version()
1.175
1.176 # The static resources reside in different locations depending on the
1.177 - # version of MoinMoin. Moreover, these resources may end up in a
1.178 - # published directory for 1.8 installations where the Web server cannot
1.179 - # be instructed to fetch the content from outside certain designated
1.180 - # locations.
1.181 + # version of MoinMoin, but the Web server is used to serve static
1.182 + # resources in both cases, even though MoinMoin 1.9 can serve static
1.183 + # files itself.
1.184 +
1.185 + # A shared data directory may be in use.
1.186
1.187 - # 1.9: moin/lib/python2.x/site-packages/MoinMoin/web/static/htdocs
1.188 + self.htdocs_dir_source = join(self.get_moin_data(), "htdocs")
1.189
1.190 - if self.moin_version.startswith("1.9"):
1.191 + if self.htdocs_dir_source is None or not exists(self.htdocs_dir_source):
1.192 +
1.193 + # 1.9: moin/lib/python2.x/site-packages/MoinMoin/web/static/htdocs
1.194
1.195 - # A shared data directory may be in use.
1.196 -
1.197 - if self.moin_data:
1.198 - self.htdocs_dir = self.htdocs_dir_source = join(self.moin_data, "htdocs")
1.199 + if self.moin_version.startswith("1.9"):
1.200 + self.htdocs_dir_source = join(self.prefix_site_packages, "MoinMoin", "web", "static", "htdocs")
1.201 else:
1.202 - self.htdocs_dir = self.htdocs_dir_source = join(self.prefix_site_packages, "MoinMoin", "web", "static", "htdocs")
1.203 + raise SetupException, "The static resources could not be found."
1.204 +
1.205 + # Add the static identifier to the URL path. For example:
1.206 + # / -> /moin_static187
1.207 + # /hgwiki -> /hgwiki-moin_static187
1.208 +
1.209 + self.static_url_path = self.url_path + (self.url_path != "/" and "-" or "") + self.get_static_identifier()
1.210
1.211 - self.static_url_path = self.url_path
1.212 + # In limited hosting, the static resources directory is related to
1.213 + # the URL path.
1.214
1.215 - # 1.8: moin/share/moin/htdocs (optionally copied to a Web directory)
1.216 + if self.limited_hosting():
1.217 + self.htdocs_dir = join(self.web_static_dir or self.web_app_dir, self.static_url_path.lstrip("/"))
1.218 +
1.219 + # Otherwise, a mapping is made to the directory.
1.220
1.221 else:
1.222 -
1.223 - # A shared data directory may be in use.
1.224 -
1.225 - if self.moin_data:
1.226 - self.htdocs_dir_source = join(self.moin_data, "htdocs")
1.227 - else:
1.228 - self.htdocs_dir_source = join(self.instance_dir, "share", "moin", "htdocs")
1.229 -
1.230 - # Add the static identifier to the URL path. For example:
1.231 - # / -> /moin_static187
1.232 - # /hgwiki -> /hgwiki-moin_static187
1.233 -
1.234 - self.static_url_path = self.url_path + (self.url_path != "/" and "-" or "") + self.get_static_identifier()
1.235 -
1.236 - # In limited hosting, the static resources directory is related to
1.237 - # the URL path.
1.238 -
1.239 - if self.limited_hosting():
1.240 - self.htdocs_dir = join(self.web_static_dir or self.web_app_dir, self.static_url_path.lstrip("/"))
1.241 -
1.242 - # Otherwise, a mapping is made to the directory.
1.243 -
1.244 - else:
1.245 - self.htdocs_dir = self.htdocs_dir_source
1.246 + self.htdocs_dir = join(self.common_dir, "htdocs")
1.247
1.248 def _get_abspath(self, d):
1.249 return d and abspath(d) or None
1.250
1.251 def get_moin_version(self):
1.252
1.253 - "Inspect the MoinMoin package information, returning the version."
1.254 + "Return the MoinMoin version."
1.255
1.256 if self.moin_distribution:
1.257 + this_dir = os.getcwd()
1.258 try:
1.259 - this_dir = os.getcwd()
1.260 - try:
1.261 - os.chdir(self.moin_distribution)
1.262 - f = open("PKG-INFO")
1.263 - try:
1.264 - for line in f.xreadlines():
1.265 - columns = line.split()
1.266 - if columns[0] == "Version:":
1.267 - return columns[1]
1.268 + os.chdir(self.moin_distribution)
1.269 + version = self.get_moin_version_from_package_info() or \
1.270 + self.get_moin_version_from_import()
1.271 + if version:
1.272 + return version
1.273 +
1.274 + finally:
1.275 + os.chdir(this_dir)
1.276 +
1.277 + else:
1.278 + return self.get_moin_version_from_import()
1.279 +
1.280 + def get_moin_version_from_package_info(self):
1.281 +
1.282 + "Inspect the MoinMoin package information, returning the version."
1.283
1.284 - return None
1.285 -
1.286 - finally:
1.287 - f.close()
1.288 + try:
1.289 + f = open("PKG-INFO")
1.290 + try:
1.291 + for line in f.xreadlines():
1.292 + columns = line.split()
1.293 + if columns[0] == "Version:":
1.294 + return columns[1]
1.295 + finally:
1.296 + f.close()
1.297
1.298 - finally:
1.299 - os.chdir(this_dir)
1.300 + except IOError:
1.301 + pass
1.302
1.303 - except IOError:
1.304 - pass
1.305 + return None
1.306 +
1.307 + def get_moin_version_from_import(self):
1.308 +
1.309 + "Return the MoinMoin version from an import of the package itself."
1.310
1.311 # Where no distribution information can be read, try and import an
1.312 # installed version module.
1.313 @@ -492,9 +510,10 @@
1.314
1.315 def get_moin_data(self):
1.316
1.317 - "Return the location of MoinMoin data."
1.318 + "Return the exact location of MoinMoin data."
1.319
1.320 - return self.moin_data or self.moin_distribution and join(self.moin_distribution, "wiki") or None
1.321 + return self.moin_distribution and join(self.moin_distribution, "wiki") or \
1.322 + self.prefix and join(self.prefix, "share", "moin") or None
1.323
1.324 def get_static_identifier(self):
1.325
1.326 @@ -506,7 +525,7 @@
1.327
1.328 "Return the directory for plugins of the given 'plugin_type'."
1.329
1.330 - data_dir = join(self.conf_dir, "data")
1.331 + data_dir = join(self.common_dir, "data")
1.332 return join(data_dir, "plugin", plugin_type)
1.333
1.334 def limited_hosting(self):
1.335 @@ -519,7 +538,7 @@
1.336
1.337 "Make sure that all the directories are available."
1.338
1.339 - for d in (self.conf_dir, self.instance_dir, self.web_app_dir, self.web_static_dir, self.web_site_dir):
1.340 + for d in (self.common_dir, self.web_app_dir, self.web_static_dir, self.web_site_dir):
1.341 if d is not None and not exists(d):
1.342 os.makedirs(d)
1.343
1.344 @@ -551,6 +570,7 @@
1.345
1.346 self.ensure_directories()
1.347 self.install_moin()
1.348 + self.edit_moin_script()
1.349 self._setup_wiki()
1.350
1.351 def setup_wiki(self):
1.352 @@ -558,13 +578,6 @@
1.353 "Set up a Wiki without installing MoinMoin."
1.354
1.355 self.ensure_directories()
1.356 -
1.357 - try:
1.358 - self.install_moin(data_only=1)
1.359 - except SetupException:
1.360 - if not self.moin_data:
1.361 - raise
1.362 -
1.363 self._setup_wiki()
1.364
1.365 def _setup_wiki(self):
1.366 @@ -572,13 +585,16 @@
1.367 "Set up a Wiki without installing MoinMoin."
1.368
1.369 self.install_data()
1.370 + self.install_static_data()
1.371 self.configure_moin()
1.372 - self.edit_moin_script()
1.373 self.add_superuser()
1.374 self.edit_moin_web_script(self.make_site_files())
1.375 self.make_post_install_script()
1.376
1.377 - def install_moin(self, data_only=0):
1.378 + if self.moin_version.startswith("1.9"):
1.379 + note("You may need to visit the LanguageSetup page in the Wiki to create the standard set of pages.")
1.380 +
1.381 + def install_moin(self):
1.382
1.383 "Enter the distribution directory and run the setup script."
1.384
1.385 @@ -593,14 +609,10 @@
1.386
1.387 log_filename = "install-%s.log" % split(self.common_dir)[-1]
1.388
1.389 - status("Installing MoinMoin%s in %s..." % (data_only and " (data only)" or "", self.prefix))
1.390 + status("Installing MoinMoin in %s..." % self.prefix)
1.391
1.392 - if data_only:
1.393 - install_cmd = "install_data"
1.394 - options = "--install-dir='%s'" % self.instance_dir
1.395 - else:
1.396 - install_cmd = "install"
1.397 - options = "--prefix='%s' --install-data='%s' --record='%s'" % (self.prefix, self.instance_dir, log_filename)
1.398 + install_cmd = "install"
1.399 + options = "--prefix='%s' --record='%s'" % (self.prefix, log_filename)
1.400
1.401 os.system("python setup.py --quiet %s %s --force" % (install_cmd, options))
1.402
1.403 @@ -608,44 +620,48 @@
1.404
1.405 def install_data(self):
1.406
1.407 - "Install Wiki data."
1.408 + "Install Wiki data into an instance."
1.409
1.410 moin_data = self.get_moin_data()
1.411
1.412 if not moin_data:
1.413 raise SetupException, \
1.414 - "Cannot install MoinMoin data without either a 'moin_distribution' or a 'moin_data' setting being defined."
1.415 + "Cannot install MoinMoin data without either a 'moin_distribution' or a 'prefix' setting being defined."
1.416
1.417 # The default wikiconfig assumes data and underlay in the same directory.
1.418
1.419 - status("Installing data and underlay in %s..." % self.conf_dir)
1.420 + status("Installing data and underlay in %s..." % self.common_dir)
1.421
1.422 for d in ("data", "underlay"):
1.423 source = join(moin_data, d)
1.424 source_tar = source + os.path.extsep + "tar"
1.425 - d_tar = source + os.path.extsep + "tar"
1.426
1.427 if os.path.exists(source):
1.428 - shutil.copytree(source, join(self.conf_dir, d))
1.429 + shutil.copytree(source, join(self.common_dir, d))
1.430 elif os.path.exists(source_tar):
1.431 - shutil.copy(source_tar, self.conf_dir)
1.432 - os.system("tar xf %s -C %s" % (d_tar, self.conf_dir))
1.433 +
1.434 + note("Copying archive %s instead of directory %s. Running...\n"
1.435 + "make pagepacks\n"
1.436 + "in the distribution directory should rectify this." % (source_tar, source))
1.437 +
1.438 + shutil.copy(source_tar, self.common_dir)
1.439 + os.system("tar xf %s -C %s" % (source_tar, self.common_dir))
1.440 else:
1.441 status("Could not copy %s into installed Wiki." % d)
1.442
1.443 - # Copy static Web data if appropriate.
1.444 + def install_static_data(self):
1.445
1.446 - if not self.moin_version.startswith("1.9") and self.limited_hosting():
1.447 + "Install static Web data if appropriate."
1.448
1.449 - if not exists(self.htdocs_dir):
1.450 - os.mkdir(self.htdocs_dir)
1.451 + if not exists(self.htdocs_dir):
1.452 + os.mkdir(self.htdocs_dir)
1.453
1.454 - for item in os.listdir(self.htdocs_dir_source):
1.455 - path = join(self.htdocs_dir_source, item)
1.456 - if isdir(path):
1.457 - shutil.copytree(path, join(self.htdocs_dir, item))
1.458 - else:
1.459 - shutil.copy(path, join(self.htdocs_dir, item))
1.460 + for item in os.listdir(self.htdocs_dir_source):
1.461 + path = join(self.htdocs_dir_source, item)
1.462 + if isdir(path):
1.463 + shutil.copytree(path, join(self.htdocs_dir, item))
1.464 + else:
1.465 + shutil.copy(path, join(self.htdocs_dir, item))
1.466
1.467 def configure_moin(self):
1.468
1.469 @@ -655,20 +671,15 @@
1.470
1.471 if not moin_data:
1.472 raise SetupException, \
1.473 - "Cannot configure MoinMoin without either a 'moin_distribution' or a 'moin_data' setting being defined."
1.474 + "Cannot configure MoinMoin without either a 'moin_distribution' or a 'prefix' setting being defined."
1.475
1.476 # NOTE: Single Wiki only so far.
1.477
1.478 - # Static URLs seem to be different in MoinMoin 1.9.x.
1.479 - # For earlier versions, reserve URL space alongside the Wiki.
1.480 # NOTE: MoinMoin usually uses an apparently common URL space associated
1.481 # NOTE: with the version, but more specific locations are probably
1.482 # NOTE: acceptable if less efficient.
1.483
1.484 - if self.moin_version.startswith("1.9"):
1.485 - url_prefix_static = "%r + url_prefix_static" % self.static_url_path
1.486 - else:
1.487 - url_prefix_static = "%r" % self.static_url_path
1.488 + url_prefix_static = "%r" % self.static_url_path
1.489
1.490 # Use a farm configuration file.
1.491
1.492 @@ -678,7 +689,7 @@
1.493 # Or copy the Wiki configuration file from the distribution.
1.494
1.495 else:
1.496 - wikiconfig_py = join(self.conf_dir, "wikiconfig.py")
1.497 + wikiconfig_py = join(self.common_dir, "wikiconfig.py")
1.498 shutil.copyfile(join(moin_data, "config", "wikiconfig.py"), wikiconfig_py)
1.499
1.500 status("Editing configuration from %s..." % wikiconfig_py)
1.501 @@ -718,9 +729,12 @@
1.502 Configure Moin, accessing the configuration file using 'wikiconfig'.
1.503 """
1.504
1.505 - if not self.moin_version.startswith("1.9"):
1.506 - data_dir = join(self.conf_dir, "data")
1.507 - data_underlay_dir = join(self.conf_dir, "underlay")
1.508 + # Specific site configurations also appear to need 'data_dir', even in
1.509 + # 1.9.
1.510 +
1.511 + if not self.moin_version.startswith("1.9") or self.site_config:
1.512 + data_dir = join(self.common_dir, "data")
1.513 + data_underlay_dir = join(self.common_dir, "underlay")
1.514
1.515 wikiconfig.set("data_dir", data_dir)
1.516 wikiconfig.set("data_underlay_dir", data_underlay_dir)
1.517 @@ -765,7 +779,7 @@
1.518
1.519 s = readfile(moin_cgi)
1.520 s = moin_cgi_prefix.sub("sys.path.insert(0, %r)" % self.prefix_site_packages, s)
1.521 - s = moin_cgi_wikiconfig.sub("sys.path.insert(0, %r)" % self.conf_dir, s)
1.522 + s = moin_cgi_wikiconfig.sub("sys.path.insert(0, %r)" % self.common_dir, s)
1.523
1.524 # Handle differences in script names when using limited hosting with
1.525 # URL rewriting.
1.526 @@ -787,6 +801,10 @@
1.527 writefile(moin_cgi_installed, s)
1.528 os.system("chmod a+rx '%s'" % moin_cgi_installed)
1.529
1.530 + # Fix the cause of opaque errors in some Apache environments.
1.531 +
1.532 + os.system("chmod go-w '%s'" % moin_cgi_installed)
1.533 +
1.534 def add_superuser(self):
1.535
1.536 "Add the superuser account."
1.537 @@ -800,12 +818,12 @@
1.538 path = os.environ.get("PYTHONPATH", "")
1.539
1.540 if path:
1.541 - os.environ["PYTHONPATH"] = path + ":" + self.conf_dir
1.542 + os.environ["PYTHONPATH"] = path + ":" + self.common_dir
1.543 else:
1.544 - os.environ["PYTHONPATH"] = self.conf_dir
1.545 + os.environ["PYTHONPATH"] = self.common_dir
1.546
1.547 cmd = moin_script + " --config-dir='%s' account create --name='%s' --email='%s' --password='%s'" % (
1.548 - self.conf_dir, self.superuser, email, password)
1.549 + self.common_dir, self.superuser, email, password)
1.550 os.system(cmd)
1.551
1.552 if path:
1.553 @@ -824,18 +842,16 @@
1.554
1.555 if not self.limited_hosting():
1.556
1.557 - site_def = join(self.web_site_dir, self.site_name)
1.558 + site_def = join(self.web_site_dir, self.site_identifier)
1.559
1.560 s = apache_site % self.__dict__
1.561 -
1.562 - if not self.moin_version.startswith("1.9"):
1.563 - s += apache_site_extra_moin18 % self.__dict__
1.564 + s += apache_site_extra % self.__dict__
1.565
1.566 status("Writing Apache site definitions to %s..." % site_def)
1.567 writefile(site_def, s)
1.568
1.569 - note("Copy the site definitions to the appropriate sites directory if appropriate.")
1.570 - note("Then, make sure that the site is enabled by running the appropriate tools (such as a2ensite).")
1.571 + note("Copy the site definitions to the appropriate sites directory if appropriate.\n"
1.572 + "Then, make sure that the site is enabled by running the appropriate tools (such as a2ensite).")
1.573
1.574 return 1
1.575
1.576 @@ -861,7 +877,7 @@
1.577
1.578 # Work out whether setfacl works.
1.579
1.580 - fd, temp_filename = tempfile.mkstemp(dir=self.conf_dir)
1.581 + fd, temp_filename = tempfile.mkstemp(dir=self.common_dir)
1.582 os.close(fd)
1.583
1.584 have_setfacl = os.system("setfacl -m user:%(web_user)s:r %(file)s > /dev/null 2>&1" % {
1.585 @@ -880,21 +896,19 @@
1.586 vars.update(locals())
1.587
1.588 for postinst_script, start, extra in [
1.589 - (postinst_scripts[0], postsetup_chown_chmod, postsetup_chown_moin18_extra),
1.590 - (postinst_scripts[1], postsetup_setfacl, postsetup_setfacl_moin18_extra)
1.591 + (postinst_scripts[0], postsetup_chown_chmod, postsetup_chown_extra),
1.592 + (postinst_scripts[1], postsetup_setfacl, postsetup_setfacl_extra)
1.593 ]:
1.594
1.595 s = start % vars
1.596 -
1.597 - if not self.moin_version.startswith("1.9"):
1.598 - s += extra % vars
1.599 + s += extra % vars
1.600
1.601 writefile(postinst_script, s)
1.602 os.chmod(postinst_script, 0755)
1.603
1.604 if have_setfacl:
1.605 - note("Run %s to set file ownership and permissions." % postinst_scripts[1])
1.606 - note("If this somehow fails...")
1.607 + note("Run %s to set file ownership and permissions.\n"
1.608 + "If this somehow fails..." % postinst_scripts[1])
1.609
1.610 note("Run %s as root to set file ownership and permissions." % postinst_scripts[0])
1.611
1.612 @@ -917,7 +931,7 @@
1.613 if self.site_config:
1.614 wikiconfig_py = self.site_config
1.615 else:
1.616 - wikiconfig_py = join(self.conf_dir, "wikiconfig.py")
1.617 + wikiconfig_py = join(self.common_dir, "wikiconfig.py")
1.618
1.619 status("Editing configuration from %s..." % wikiconfig_py)
1.620
1.621 @@ -947,7 +961,7 @@
1.622 if self.farm_config:
1.623 wikiconfig_py = self.farm_config
1.624 else:
1.625 - wikiconfig_py = join(self.conf_dir, "wikiconfig.py")
1.626 + wikiconfig_py = join(self.common_dir, "wikiconfig.py")
1.627
1.628 status("Editing configuration from %s..." % wikiconfig_py)
1.629
1.630 @@ -1047,8 +1061,8 @@
1.631 if exists(css_file_path):
1.632 shutil.copy(css_file_path, target_dir)
1.633
1.634 - note("Don't forget to add theme resources for extensions for this theme.")
1.635 - note("Don't forget to edit this theme's stylesheets for extensions.")
1.636 + note("Don't forget to add theme resources for extensions for this theme.\n"
1.637 + "Don't forget to edit this theme's stylesheets for extensions.")
1.638
1.639 def install_extension_package(self, extension_dir):
1.640
1.641 @@ -1248,9 +1262,9 @@
1.642 path = os.environ.get("PYTHONPATH", "")
1.643
1.644 if path:
1.645 - os.environ["PYTHONPATH"] = path + ":" + self.prefix_site_packages + ":" + self.conf_dir
1.646 + os.environ["PYTHONPATH"] = path + ":" + self.prefix_site_packages + ":" + self.common_dir
1.647 else:
1.648 - os.environ["PYTHONPATH"] = self.prefix_site_packages + ":" + self.conf_dir
1.649 + os.environ["PYTHONPATH"] = self.prefix_site_packages + ":" + self.common_dir
1.650
1.651 installer = join(self.prefix_site_packages, "MoinMoin", "packages.py")
1.652 cmd = "python %s i %s" % (installer, package_filename)
1.653 @@ -1271,7 +1285,7 @@
1.654
1.655 # Command line option syntax.
1.656
1.657 -syntax_description = "[ -f <config-filename> ] ( <method> | --method=METHOD ) [ <method-argument> ... ]"
1.658 +syntax_description = "[ -f <config-filename> ] ( -m <method> | --method=METHOD ) [ <method-argument> ... ]"
1.659
1.660 # Main program.
1.661
1.662 @@ -1296,6 +1310,11 @@
1.663
1.664 try:
1.665 config_filename = args.get("config-filename", "moinsetup.cfg")
1.666 +
1.667 + if not exists(config_filename):
1.668 + print "Configuration", config_filename, "not found."
1.669 + sys.exit(1)
1.670 +
1.671 config = ConfigParser()
1.672 config.read(config_filename)
1.673
1.674 @@ -1309,6 +1328,8 @@
1.675 installation = Installation(**config_arguments)
1.676
1.677 except TypeError, exc:
1.678 + print "Error:"
1.679 + print
1.680 print exc.args[0]
1.681 print
1.682 print "Configuration settings:"
1.683 @@ -1327,13 +1348,15 @@
1.684
1.685 try:
1.686 method(*method_arguments)
1.687 - except TypeError:
1.688 + except TypeError, exc:
1.689 + print "Error:"
1.690 + print
1.691 print exc.args[0]
1.692 print
1.693 print "Method documentation:"
1.694 print
1.695 print method.__doc__
1.696 print
1.697 - raise
1.698 + sys.exit(1)
1.699
1.700 # vim: tabstop=4 expandtab shiftwidth=4