def post(self, command, output_dir, vars):
     packagedir = os.path.join(output_dir, vars["package"])
     controllersdir = os.path.join(packagedir, "controllers")
     controllersfile = os.path.join(packagedir, "controllers.py")
     rootfile = os.path.join(controllersdir, "root.py")
     if os.path.exists(controllersdir) and \
         os.path.exists(controllersfile):
         controllerstext = open(controllersfile).read()
         roottext = open(rootfile).read()
         from paste.script.copydir import query_interactive
         thesame = controllerstext == roottext
         if not thesame:
             print "\nYou seem to be upgrading from a smaller quickstart."
             print "There is currently a controllers package and a"
             print "controllers module, which would get confusing."
         if not command.simulate and (controllerstext == roottext
                 or query_interactive(controllersfile, rootfile,
                     controllerstext, roottext, False)):
             shutil.copyfile(controllersfile, rootfile)
             try:
                 if not os.path.exists(os.path.join(os.path.dirname(
                         os.path.abspath(controllersfile)), '.svn')):
                     raise OSError
                 command.run_command('svn', 'revert', controllersfile)
                 command.run_command('svn', 'delete', controllersfile)
             except OSError:
                 os.unlink(controllersfile)
             controllerspyc = controllersfile + "c"
             if os.path.exists(controllerspyc):
                 os.unlink(controllerspyc)
Example #2
0
 def post(self, command, output_dir, vars):
     packagedir = os.path.join(output_dir, vars["package"])
     controllersdir = os.path.join(packagedir, "controllers")
     controllersfile = os.path.join(packagedir, "controllers.py")
     rootfile = os.path.join(controllersdir, "root.py")
     if os.path.exists(controllersdir) and \
         os.path.exists(controllersfile):
         controllerstext = open(controllersfile).read()
         roottext = open(rootfile).read()
         from paste.script.copydir import query_interactive
         thesame = controllerstext == roottext
         if not thesame:
             print "\nYou seem to be upgrading from a smaller quickstart."
             print "There is currently a controllers package and a"
             print "controllers module, which would get confusing."
         if not command.simulate and (controllerstext == roottext
                 or query_interactive(controllersfile, rootfile,
                     controllerstext, roottext, False)):
             shutil.copyfile(controllersfile, rootfile)
             try:
                 if not os.path.exists(os.path.join(os.path.dirname(
                         os.path.abspath(controllersfile)), '.svn')):
                     raise OSError
                 command.run_command('svn', 'revert', controllersfile)
                 command.run_command('svn', 'delete', controllersfile)
             except OSError:
                 os.unlink(controllersfile)
             controllerspyc = controllersfile + "c"
             if os.path.exists(controllerspyc):
                 os.unlink(controllerspyc)