コード例 #1
0
ファイル: __init__.py プロジェクト: gborelli/mr.migrator
    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        args = {}
        for k,v in self.options.items():
            if '-' in k:
                part,key = k.split('-',1)
                args.setdefault(part, {})[key] = v
        default = buildout['buildout']['directory']+'/var/cache'
        
        self.options['scripts'] = 'migrate=%s'%name

        self.options['eggs'] = """
                mr.migrator
                """ + self.options.get('eggs','')
        pipeline = self.options['pipeline']
        if ':' in pipeline:
            package, pipeline_name = pipeline.split(':')
            self.options['eggs'] += "  %s"%package

        pipeline = self.options.get('pipeline',None)
        if pipeline:
            self.options['arguments'] =  str(args)+',"'+pipeline+'"'
        else:
            self.options['arguments'] =  str(args)
        return  Scripts.__init__(self, buildout, name, options)
コード例 #2
0
    def __init__(self, buildout, name, options):
        self.egg = Egg(buildout, options['recipe'], options)
        self.buildout, self.options, self.name = buildout, options, name
        self.scripts = True

        options['location'] = os.path.join(
            buildout['buildout']['parts-directory'],
            self.name,
            )
        options['bin-directory'] = buildout['buildout']['bin-directory']

        if 'scripts' in options:
            if options['scripts'] == '':
                options['scripts'] = '' # suppress script generation.
                self.scripts = False

        # Relative path support for the generated scripts
        relative_paths = options.get(
            'relative-paths',
            buildout['buildout'].get('relative-paths', 'false')
            )
        if relative_paths == 'true':
            options['buildout-directory'] = buildout['buildout']['directory']
            self._relative_paths = options['buildout-directory']
        else:
            self._relative_paths = ''

        self._include_site_packages = options.get(
            'include-site-packages',
            buildout['buildout'].get('include-site-packages', 'false')
            ) not in ('off', 'disable', 'false')

        # Get Scripts' attributes
        return Scripts.__init__(self, buildout, name, options)
コード例 #3
0
    def install(self, update=False):
        options = self.options
        location = options['location']
        installed = [location]

        if not update:
            if os.path.exists(location):
                shutil.rmtree(location)

            # We could check with pkg_resources which Zope version we have.
            # But we support creating instances for 4 only.
            version = '4'
            make.make_instance(options.get('user', None), location, version)

        try:
            # Make a new zope.conf based on options in buildout.cfg
            self.build_zope_conf()

            # Install extra scripts
            installed.extend(self.install_scripts())

            # Add zcml files to package-includes
            self.build_package_includes()
        except:
            # clean up
            if os.path.exists(location):
                shutil.rmtree(location)
            raise

        if self.scripts:
            retval = Scripts.install(self)
            retval.extend(installed)
        else:
            retval = installed
        return retval
コード例 #4
0
ファイル: __init__.py プロジェクト: gborelli/mr.migrator
    def install(self):
        """Installer"""
        # XXX Implement recipe functionality here




        # Return files that were created by the recipe. The buildout
        # will remove all returned files upon reinstall.
        return Scripts.install(self)
コード例 #5
0
    def install(self, update=False):
        options = self.options
        location = options['location']
        installed = [location]

        if not update:
            if os.path.exists(location):
                shutil.rmtree(location)

            # Which Zope2 version do we have?
            dist = pkg_resources.get_distribution('Zope2')
            parsed = dist.parsed_version
            major, minor = parsed[0:2]
            major = int(major)
            # We support creating instances for 2.12, 2.13 and 4.0
            if major >= 4:
                major = 2
                minor = 13
            elif major == 2:
                minor = int(minor)
                if minor > 13:
                    minor = 13
            version = str(major) + str(minor)
            make.make_instance(options.get('user', None), location, version)

        try:
            # Make a new zope.conf based on options in buildout.cfg
            self.build_zope_conf()

            # Install extra scripts
            installed.extend(self.install_scripts())

            # Add zcml files to package-includes
            self.build_package_includes()
        except:
            # clean up
            if os.path.exists(location):
                shutil.rmtree(location)
            raise

        if self.scripts:
            retval = Scripts.install(self)
            retval.extend(installed)
        else:
            retval = installed
        return retval
コード例 #6
0
    def install(self, update=False):
        options = self.options
        location = options['location']
        installed = [location]

        if not update:
            if os.path.exists(location):
                shutil.rmtree(location)

            # Which Zope2 version do we have?
            dist = pkg_resources.get_distribution('Zope2')
            parsed = dist.parsed_version
            major, minor = parsed[0:2]
            major = int(major)
            # We support creating instances for 2.12, 2.13 and 4.0
            if major >= 4:
                major = 2
                minor = 13
            elif major == 2:
                minor = int(minor)
                if minor > 13:
                    minor = 13
            version = str(major) + str(minor)
            make.make_instance(options.get('user', None), location, version)

        try:
            # Make a new zope.conf based on options in buildout.cfg
            self.build_zope_conf()

            # Install extra scripts
            installed.extend(self.install_scripts())

            # Add zcml files to package-includes
            self.build_package_includes()
        except:
            # clean up
            if os.path.exists(location):
                shutil.rmtree(location)
            raise

        if self.scripts:
            retval = Scripts.install(self)
            retval.extend(installed)
        else:
            retval = installed
        return retval
コード例 #7
0
    def __init__(self, buildout, name, options):
        self.egg = Egg(buildout, options['recipe'], options)
        self.buildout, self.options, self.name = buildout, options, name
        self.scripts = True

        options['location'] = os.path.join(
            buildout['buildout']['parts-directory'],
            self.name,
        )
        options['bin-directory'] = buildout['buildout']['bin-directory']

        if 'initialization' not in options:
            options['initialization'] = ''

        if 'scripts' in options:
            if options['scripts'] == '':
                options['scripts'] = ''  # suppress script generation.
                self.scripts = False

        # Relative path support for the generated scripts
        relative_paths = options.get(
            'relative-paths',
            buildout['buildout'].get('relative-paths', 'false')
        )
        if relative_paths == 'true':
            options['buildout-directory'] = buildout['buildout']['directory']
            self._relative_paths = options['buildout-directory']
        else:
            self._relative_paths = ''

        self._include_site_packages = options.get(
            'include-site-packages',
            buildout['buildout'].get('include-site-packages', 'false')
        ) not in ('off', 'disable', 'false')

        self.wsgi = True
        self.wsgi_config = os.path.join(options['location'], 'etc', 'wsgi.ini')
        wsgi_opt = options.get('wsgi', 'on')
        if six.PY2 and wsgi_opt.lower() in ('off', 'false', '0'):
            self.wsgi = False
        elif wsgi_opt.lower() not in ('on', 'true', '1'):
            self.wsgi_config = wsgi_opt

        # Get Scripts' attributes
        return Scripts.__init__(self, buildout, name, options)
コード例 #8
0
ファイル: __init__.py プロジェクト: jean/funnelweb
    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        args = {}
        for k,v in self.options.items():
            if '-' not in k:
                continue
            part,key = k.split('-',1)
            args.setdefault(part, {})[key] = v
        default = buildout['buildout']['directory']+'/var/cache'


        self.options['eggs'] = """
                transmogrify.webcrawler
                transmogrify.siteanalyser
                transmogrify.htmlcontentextractor
                transmogrify.pathsorter
                transmogrify.ploneremote
                funnelweb
                """ + self.options.get('eggs','')
        self.options['arguments'] =  str(args)
        return  Scripts.__init__(self, buildout, name, options)
コード例 #9
0
ファイル: __init__.py プロジェクト: adamcheasley/mr.migrator
    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        args = {}
        for k, v in self.options.items():
            if '-' in k:
                part, key = k.split('-', 1)
                args.setdefault(part, {})[key] = v

        self.options['scripts'] = 'migrate=%s' % name

        self.options['eggs'] = """
                mr.migrator
                """ + self.options.get('eggs', '')
        pipeline = self.options['pipeline']
        if ':' in pipeline:
            package, pipeline_name = pipeline.split(':')
            self.options['eggs'] += "  %s" % package

        pipeline = self.options.get('pipeline', None)
        if pipeline:
            self.options['arguments'] = str(args) + ',"' + pipeline + '"'
        else:
            self.options['arguments'] = str(args)

        # Process zcml
        partsdir = self.buildout['buildout']['parts-directory']
        newdir = partsdir + '/migrate'
        if not os.path.exists(newdir):
            os.mkdir(newdir)

        newdir = partsdir + '/migrate/etc'
        if not os.path.exists(newdir):
            os.mkdir(newdir)

        self.options['location'] = self.buildout[
            'buildout']['parts-directory'] + '/migrate'
        if 'zcml' in options:
            self.build_package_includes()

        return Scripts.__init__(self, buildout, name, options)
コード例 #10
0
    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        args = {}
        for k, v in self.options.items():
            if '-' in k:
                part, key = k.split('-', 1)
                args.setdefault(part, {})[key] = v

        self.options['scripts'] = 'migrate=%s' % name

        self.options['eggs'] = """
                mr.migrator
                """ + self.options.get('eggs', '')
        pipeline = self.options['pipeline']
        if ':' in pipeline:
            package, pipeline_name = pipeline.split(':')
            self.options['eggs'] += "  %s" % package

        pipeline = self.options.get('pipeline', None)
        if pipeline:
            self.options['arguments'] = str(args) + ',"' + pipeline + '"'
        else:
            self.options['arguments'] = str(args)

        # Process zcml
        partsdir = self.buildout['buildout']['parts-directory']
        newdir = partsdir + '/migrate'
        if not os.path.exists(newdir):
            os.mkdir(newdir)

        newdir = partsdir + '/migrate/etc'
        if not os.path.exists(newdir):
            os.mkdir(newdir)

        self.options['location'] = self.buildout[
            'buildout']['parts-directory'] + '/migrate'
        if 'zcml' in options:
            self.build_package_includes()

        return Scripts.__init__(self, buildout, name, options)
コード例 #11
0
    def install(self, update=False):
        options = self.options
        location = options['location']
        installed = [location]

        if not update:
            if os.path.exists(location):
                shutil.rmtree(location)

            # We could check with pkg_resources which Zope version we have.
            # But we support creating instances for 4 only.
            version = '4'
            make.make_instance(options.get('user', None), location, version)

        try:
            # Make a new zope.conf and wsgi.ini
            # based on options in buildout.cfg
            self.build_zope_conf()
            if self.wsgi:
                self.build_wsgi_ini()

            # Install extra scripts
            installed.extend(self.install_scripts())

            # Add zcml files to package-includes
            self.build_package_includes()
        except Exception:
            # clean up
            if os.path.exists(location):
                shutil.rmtree(location)
            raise

        if self.scripts:
            retval = Scripts.install(self)
            retval.extend(installed)
        else:
            retval = installed
        return retval
コード例 #12
0
ファイル: __init__.py プロジェクト: adamcheasley/mr.migrator
 def update(self):
     """Updater"""
     return Scripts.update(self)
コード例 #13
0
 def update(self):
     """Updater"""
     return Scripts.update(self)
コード例 #14
0
 def install(self):
     """Installer"""
     # XXX Implement recipe functionality here
     # Return files that were created by the recipe. The buildout
     # will remove all returned files upon reinstall.
     return Scripts.install(self)