Пример #1
0
    def run(self):
        # dependencies, links, etc...
        develop_indico.run(self)

        local = 'etc/indico.conf'
        if os.path.exists(local):
            print 'Upgrading existing etc/indico.conf...'
        else:
            print 'Creating new etc/indico.conf..'
            shutil.copy('etc/indico.conf.sample', local)

        upgrade_indico_conf(local, 'etc/indico.conf.sample', {
                'BaseURL': 'http://localhost:{0}'.format(self.http_port),
                'BaseSecureURL': 'https://localhost:{0}'.format(self.https_port),
                'DBConnectionParams': ("localhost", int(self.zodb_port)),
                'SmtpServer': ("localhost", int(self.smtp_port))
                })

        for f in [x for x in ('etc/zdctl.conf', 'etc/zodb.conf', 'etc/logging.conf') if not os.path.exists(x)]:
            shutil.copy('%s.sample' % f, f)

        print """\nIndico needs to store some information in the filesystem (database, cache, temporary files, logs...)
Please specify the directory where you'd like it to be placed.
(Note that putting it outside of your sourcecode tree is recommended)"""
        prefixDirDefault = os.path.dirname(os.getcwd())
        prefixDir = raw_input('Full path [%s]: ' % prefixDirDefault).strip()

        if prefixDir == '':
            prefixDir = prefixDirDefault

        directories = dict((d, os.path.join(prefixDir, d)) for d in
                           ['db', 'log', 'tmp', 'cache', 'archive'])

        print 'Creating directories...',
        for d in directories.values():
            if not os.path.exists(d):
                os.makedirs(d)
        print 'Done!'

        # add existing dirs
        directories.update(dict((d, os.path.join(os.getcwd(), 'indico', d)) for d in ['htdocs', 'bin', 'etc', 'doc']))

        self._update_conf_dir_paths(local, directories)

        # avoid modifying the htdocs folder permissions (it brings problems with git)
        directories.pop('htdocs')

        from MaKaC.consoleScripts.installBase import _databaseText, _findApacheUserGroup, _checkDirPermissions, \
            _updateDbConfigFiles, _updateMaKaCEggCache

        user = getpass.getuser()
        sourcePath = os.getcwd()

        if self.use_apache:
            # find the apache user/group
            user, group = _findApacheUserGroup(self.www_uid, self.www_gid)
            _checkDirPermissions(directories, dbInstalledBySetupPy=directories['db'], accessuser=user, accessgroup=group)

        _updateDbConfigFiles(os.path.join(sourcePath, 'etc'),
                             db=directories['db'],
                             log=directories['log'],
                             tmp=directories['tmp'],
                             port=self.zodb_port,
                             uid=user)

        _updateMaKaCEggCache(os.path.join(os.path.dirname(__file__), 'indico', 'MaKaC', '__init__.py'),
                             directories['tmp'])

        compile_languages(self)
        print '''
%s
        ''' % _databaseText('etc')
Пример #2
0
    def run(self):
        # dependencies, links, etc...
        develop_indico.run(self)

        local = 'etc/indico.conf'
        if os.path.exists(local):
            print 'Upgrading existing etc/indico.conf...'
        else:
            print 'Creating new etc/indico.conf..'
            shutil.copy('etc/indico.conf.sample', local)

        upgrade_indico_conf(
            local, 'etc/indico.conf.sample', {
                'BaseURL': 'http://localhost:{0}'.format(self.http_port),
                'BaseSecureURL': 'https://localhost:{0}'.format(
                    self.https_port),
                'DBConnectionParams': ("localhost", int(self.zodb_port)),
                'SmtpServer': ("localhost", int(self.smtp_port))
            })

        for f in [
                x for x in ('etc/zdctl.conf', 'etc/zodb.conf',
                            'etc/logging.conf') if not os.path.exists(x)
        ]:
            shutil.copy('%s.sample' % f, f)

        print """\nIndico needs to store some information in the filesystem (database, cache, temporary files, logs...)
Please specify the directory where you'd like it to be placed.
(Note that putting it outside of your sourcecode tree is recommended)"""
        prefixDirDefault = os.path.dirname(os.getcwd())
        prefixDir = raw_input('Full path [%s]: ' % prefixDirDefault).strip()

        if prefixDir == '':
            prefixDir = prefixDirDefault

        directories = dict((d, os.path.join(prefixDir, d))
                           for d in ['db', 'log', 'tmp', 'cache', 'archive'])

        print 'Creating directories...',
        for d in directories.values():
            if not os.path.exists(d):
                os.makedirs(d)
        print 'Done!'

        # add existing dirs
        directories.update(
            dict((d, os.path.join(os.getcwd(), 'indico', d))
                 for d in ['htdocs', 'bin', 'etc', 'doc']))

        self._update_conf_dir_paths(local, directories)

        # avoid modifying the htdocs folder permissions (it brings problems with git)
        directories.pop('htdocs')

        from MaKaC.consoleScripts.installBase import _databaseText, _findApacheUserGroup, _checkDirPermissions, \
            _updateDbConfigFiles, _updateMaKaCEggCache

        user = getpass.getuser()
        sourcePath = os.getcwd()

        if self.use_apache:
            # find the apache user/group
            user, group = _findApacheUserGroup(self.www_uid, self.www_gid)
            _checkDirPermissions(directories,
                                 dbInstalledBySetupPy=directories['db'],
                                 accessuser=user,
                                 accessgroup=group)

        _updateDbConfigFiles(os.path.join(sourcePath, 'etc'),
                             db=directories['db'],
                             log=directories['log'],
                             tmp=directories['tmp'],
                             port=self.zodb_port,
                             uid=user)

        _updateMaKaCEggCache(
            os.path.join(os.path.dirname(__file__), 'indico', 'MaKaC',
                         '__init__.py'), directories['tmp'])

        compile_languages(self)
        print '''
%s
        ''' % _databaseText('etc')