# HG changeset patch # User Paul Boddie # Date 1273783691 -7200 # Node ID b6c4091689f52ea955db3c4117fce0f348dab56a # Parent 6bf43fcaff8198f0a869d42d1b8b1029aad05bdc Moved directory testing and creation into a separate method. Reorganised the main program structure somewhat. diff -r 6bf43fcaff81 -r b6c4091689f5 moinsetup.py --- a/moinsetup.py Thu May 13 22:33:07 2010 +0200 +++ b/moinsetup.py Thu May 13 22:48:11 2010 +0200 @@ -148,14 +148,19 @@ finally: os.chdir(this_dir) - def setup(self): + def ensure_directories(self): - "Set up the installation." + "Make sure that all the directories are available." for d in (self.conf_dir, self.instance_dir, self.web_app_dir, self.web_site_dir): if not exists(d): os.makedirs(d) + def setup(self): + + "Set up the installation." + + self.ensure_directories() self.install_moin() self.install_data() self.configure_moin() @@ -352,21 +357,17 @@ try: matches = syntax.get_args(sys.argv[1:]) args = matches[0] - except IndexError: - print "Syntax:" - print sys.argv[0], syntax_description - print - print "Arguments:" - print Installation.__init__.__doc__ - sys.exit(1) + + # Obtain as many arguments as needed for the configuration. + + arguments = args["argument"] - # Obtain as many arguments as needed for the configuration. - - arguments = args["argument"] + # Attempt to initialise the configuration. - try: installation = Installation(*arguments) - except TypeError: + + except (IndexError, TypeError): + print "Syntax:" print sys.argv[0], syntax_description print print "Arguments:"