Example #1
0
    def __init__(self, buildout, name, options):
        egg.Recipe.__init__(self, buildout, name, options)
        self.not_filtered = []
        self.arguments = self.options.get('arguments', '')
        self.zap = splitstrip(self.options.get('zap', ''))
        # integration with buildout.minitagificator
        self.for_buildoutscripts = options.get(
            'buildoutscripts', getattr(self, 'for_patchs', False))
        self.initialization = self.options.get('initialization', '')
        self.env_initialization = self.options.get('env_initialization', '')
        self.options_scripts = self.options.get('scripts', '')
        self.entry_points_options = self.options.get('entry-points',
                                                     '').strip()
        self.interpreter = self.options.get('interpreter', '').strip()
        self.dependent_scripts = bool(
            self.options.get('dependent-scripts', '').strip())
        template_replacements_opt = self.options.get('template-replacements',
                                                     '')
        self.template_replacements = template_replacements.copy()
        for k in template_replacements_opt.split('\n'):
            if ' => ' in k:
                rep, value = k.split(' => ')
                self.template_replacements[re.compile(rep, re_flags)] = value

        self.env_file = self.options.get('env-file', '').strip()
        self.bin = self.buildout['buildout'].get(
            'bin-directory', os.path.join(os.getcwd(), 'bin'))
        if self.extra_paths:
            self.extra_paths = [
                p for p in self.extra_paths if os.path.exists(p)
            ]
            options['extra-paths'] = '\n'.join(self.extra_paths)
    def __init__(self, buildout, name, options):
        egg.Recipe.__init__(self,
                            buildout, name, options)
        self.not_filtered = []
        self.arguments = self.options.get('arguments', '')
        self.zap = splitstrip(self.options.get('zap', ''))
        # integration with buildout.minitagificator
        self.for_buildoutscripts = options.get('buildoutscripts', getattr(self, 'for_patchs',False))
        self.initialization = self.options.get('initialization', '')
        self.env_initialization = self.options.get('env_initialization', '')
        self.options_scripts = self.options.get('scripts', '')
        self.entry_points_options = self.options.get('entry-points', '').strip()
        self.interpreter = self.options.get('interpreter', '').strip()
        self.dependent_scripts = bool(self.options.get('dependent-scripts', '').strip())
        template_replacements_opt = self.options.get('template-replacements', '')
        self.template_replacements = template_replacements.copy()
        for k in template_replacements_opt.split('\n'):
            if ' => ' in k:
                rep, value = k.split(' => ')
                self.template_replacements[re.compile(rep, re_flags)] = value

        self.env_file = self.options.get('env-file', '').strip()
        self.bin = self.buildout['buildout'].get('bin-directory',
                                                 os.path.join(os.getcwd(), 'bin'))
        if self.extra_paths:
            self.extra_paths = [p for p in self.extra_paths if os.path.exists(p)]
            options['extra-paths'] = '\n'.join(self.extra_paths)
Example #3
0
    def __init__(self, buildout, name, options):

        common.MinitageCommonRecipe.__init__(self,
                                             buildout,
                                             name,
                                             options)
        # handle share mode, compatibility with zc.recipe.cmmi
        self.shared = False
        self.shared_top = os.path.join(self.download_cache, 'cmmi')
        if not os.path.isdir(self.shared_top):
                os.makedirs(self.shared_top)


        # configure script for cmmi packages
        self.configure = options.get('configure-%s' % self.osxflavor, None)
        if not self.configure:
            self.configure = options.get('configure-%s' % self.uname.lower(), None)
        if not self.configure:
            self.configure = options.get('configure', 'configure')

        # prefix separtor in ./configure --prefix%SEPARATOR%path
        self.prefix_separator = options.get('prefix-separator', '=')
        if self.prefix_separator == '':
            self.prefix_separator = ' '
        self.prefix_option = self.options.get(
            'prefix-option',
            '--prefix%s' % self.prefix_separator)

        # configuration options
        self.move_lafiles = self.options.get('move-lafiles', '').strip()
        self.autogen = self.options.get('autogen', '').strip()
        self.configure_options = ' '.join(
            splitstrip(
                self.options.get( 'configure-options', '')
            )
        )
        self.configure_options += ' %s ' % ' '.join(
            splitstrip(
                self.options.get( 'extra_options', '')
            )
        )
        # compatibility with zc/recipe.cmmi
        self.extra_options = self.configure_options
        self.patch = self.patch_cmd
        # conditionnaly add OS specifics patches.
        self.configure_options += ' %s' % (
            self.options.get('configure-options-%s' % (self.uname.lower()), '')
        )

        # configure options per os
        configoptreplacer = self.options.get(
            'configure-options-replace-%s' % self.uname.lower(),
            ''
        ).strip()
        if configoptreplacer:
            self.configure_options = ' %s' % (configoptreplacer)
        else:
            configoptreplacer = self.options.get(
                'configure-options-%s-replace' % self.uname.lower(),
                ''
            ).strip()
            if configoptreplacer:
                self.configure_options = ' %s' % (configoptreplacer)




        if 'darwin' in self.uname.lower():
            kv = uname()[2]
            osxflavor = None
            if kv == '9.8.0':
                osxflavor = 'leopard'
            if kv.startswith('10.'):
                osxflavor = 'snowleopard'
            if osxflavor:
                self.configure_options += ' %s' % self.options.get('configure-options-%s' % osxflavor, '')

        self.configure_options = common.ENDLINE.sub(' ', self.configure_options)

        # if gmake is setted. taking it as the make cmd !
        # be careful to have a 'gmake' in your path
        # we have to make it only in non linux env.
        # if wehave gmake setted, use gmake too.
        gnumake = 'make'
        if (
            self.options.get('gmake',
                self.buildout.get('part', {}).get('gmake', None)
            )
            and self.uname not in ['cygwin', 'linux']
        ):
            gnumake = 'gmake'
        self.options['make-binary'] = self.make_cmd = self.options.get('make-binary-%s'%self.uname,
                                        self.options.get('make-binary', gnumake)).strip()
        self.options['make-options'] = self.make_options = self.options.get('make-options-%s'%self.uname,
                                                 self.options.get('make-options', '')).strip()

        # what we will install.
        # if 'make-targets'  present, we get it line by line
        # and all target must be specified
        # We will default to make '' and make install
        self.install_in_place = self.options.get('install-in-place')
        self.makedir = self.options.get('makedir-%s'%self.uname, self.options.get('makedir', '')).strip()
        self.makeinstalldir = self.options.get('makeinstalldir-%s'%self.uname,
                                               self.options.get('makeinstalldir','')).strip()
        self.make_targets = splitstrip(
            self.options.get('make-targets-%s'%self.uname,
                             self.options.get( 'make-targets', ' ')),
            '\n'
        )
        if not self.make_targets:
            self.make_targets = ['']


        self.make_install_append_options = self.options.get('make-install-append-options%s'%self.uname,
                                                self.options.get('make-install-append-options', '')).strip()
        self.install_options = self.options.get('make-install-options%s'%self.uname, self.options.get('make-install-options', ''))
        self.install_targets =  ['%s %s' % (a, self.install_options)
                                 for a in splitstrip(
                                     self.options.get(
                                         'make-install-targets%s'%self.uname,
                                         self.options.get( 'make-install-targets', 'install')),
                                     '\n'
                                 )]

        # shared builds
        if 'shared' in self.options:
            self.shared = os.path.join(
                self.shared_top,
                self._state_hash()
            )
            self.prefix = options['location'] = self.shared

        # 'no' options
        self.noconfigure = options.get('noconfigure-%s'%self.uname,
                                        options.get('noconfigure', ''))
        self.nomake = options.get('nomake-%s'%self.uname,
                                  options.get('nomake', ''))
        self.noinstall = options.get('noinstall-%s'%self.uname,
                                     options.get('noinstall', ''))
Example #4
0
    def __init__(self, buildout, name, options):

        common.MinitageCommonRecipe.__init__(self, buildout, name, options)
        # handle share mode, compatibility with zc.recipe.cmmi
        self.shared = False
        self.shared_top = os.path.join(self.download_cache, 'cmmi')
        if not os.path.isdir(self.shared_top):
            os.makedirs(self.shared_top)

        # configure script for cmmi packages
        self.configure = options.get('configure-%s' % self.osxflavor, None)
        if not self.configure:
            self.configure = options.get('configure-%s' % self.uname.lower(),
                                         None)
        if not self.configure:
            self.configure = options.get('configure', 'configure')

        # prefix separtor in ./configure --prefix%SEPARATOR%path
        self.prefix_separator = options.get('prefix-separator', '=')
        if self.prefix_separator == '':
            self.prefix_separator = ' '
        self.prefix_option = self.options.get(
            'prefix-option', '--prefix%s' % self.prefix_separator)

        # configuration options
        self.move_lafiles = self.options.get('move-lafiles', '').strip()
        self.autogen = self.options.get('autogen', '').strip()
        self.configure_options = ' '.join(
            splitstrip(self.options.get('configure-options', '')))
        self.configure_options += ' %s ' % ' '.join(
            splitstrip(self.options.get('extra_options', '')))
        # compatibility with zc/recipe.cmmi
        self.extra_options = self.configure_options
        self.patch = self.patch_cmd
        # conditionnaly add OS specifics patches.
        self.configure_options += ' %s' % (self.options.get(
            'configure-options-%s' % (self.uname.lower()), ''))

        # configure options per os
        configoptreplacer = self.options.get(
            'configure-options-replace-%s' % self.uname.lower(), '').strip()
        if configoptreplacer:
            self.configure_options = ' %s' % (configoptreplacer)
        else:
            configoptreplacer = self.options.get(
                'configure-options-%s-replace' % self.uname.lower(),
                '').strip()
            if configoptreplacer:
                self.configure_options = ' %s' % (configoptreplacer)

        if 'darwin' in self.uname.lower():
            kv = uname()[2]
            osxflavor = None
            if kv == '9.8.0':
                osxflavor = 'leopard'
            if kv.startswith('10.'):
                osxflavor = 'snowleopard'
            if osxflavor:
                self.configure_options += ' %s' % self.options.get(
                    'configure-options-%s' % osxflavor, '')

        self.configure_options = common.ENDLINE.sub(' ',
                                                    self.configure_options)

        # if gmake is setted. taking it as the make cmd !
        # be careful to have a 'gmake' in your path
        # we have to make it only in non linux env.
        # if wehave gmake setted, use gmake too.
        gnumake = 'make'
        if self.buildout.get('part', {}).get('gmake', None)\
           and self.uname not in ['cygwin', 'linux']:
            gnumake = 'gmake'
        self.options['make-binary'] = self.make_cmd = self.options.get(
            'make-binary-%s' % self.uname,
            self.options.get('make-binary', gnumake)).strip()
        self.options['make-options'] = self.make_options = self.options.get(
            'make-options-%s' % self.uname,
            self.options.get('make-options', '')).strip()

        # what we will install.
        # if 'make-targets'  present, we get it line by line
        # and all target must be specified
        # We will default to make '' and make install
        self.install_in_place = self.options.get('install-in-place')
        self.makedir = self.options.get('makedir-%s' % self.uname,
                                        self.options.get('makedir',
                                                         '')).strip()
        self.makeinstalldir = self.options.get(
            'makeinstalldir-%s' % self.uname,
            self.options.get('makeinstalldir', '')).strip()
        self.make_targets = splitstrip(
            self.options.get('make-targets-%s' % self.uname,
                             self.options.get('make-targets', ' ')), '\n')
        if not self.make_targets:
            self.make_targets = ['']

        self.make_install_append_options = self.options.get(
            'make-install-append-options%s' % self.uname,
            self.options.get('make-install-append-options', '')).strip()
        self.install_options = self.options.get(
            'make-install-options%s' % self.uname,
            self.options.get('make-install-options', ''))
        self.install_targets = [
            '%s %s' % (a, self.install_options) for a in splitstrip(
                self.options.get(
                    'make-install-targets%s' % self.uname,
                    self.options.get('make-install-targets', 'install')), '\n')
        ]

        # shared builds
        if 'shared' in self.options:
            self.shared = os.path.join(self.shared_top, self._state_hash())
            self.prefix = options['location'] = self.shared

        # 'no' options
        self.noconfigure = options.get('noconfigure-%s' % self.uname,
                                       options.get('noconfigure', ''))
        self.nomake = options.get('nomake-%s' % self.uname,
                                  options.get('nomake', ''))
        self.noinstall = options.get('noinstall-%s' % self.uname,
                                     options.get('noinstall', ''))
 def testSplitStrip(self):
     """testSplitStrip."""
     self.assertEquals(
         common.splitstrip(' \n666\n2012\n\n\t\n'),
         ['666', '2012']
     )
Example #6
0
                except Exception, e:
                    message = 'Problem looking for \'%s\' minibuild'
                    self.logger.debug(message % self.str_minibuild)
                if m:
                    if m.category == 'eggs':
                        if not dep in minibuild_eggs:
                            minibuild_eggs.append(dep)
                    if m.category == 'dependencies':
                        minibuild_dependencies.append(dep)

        self.minitage_dependencies.extend(
            [os.path.abspath(os.path.join(
                self.minitage_directory,
                'dependencies', s, 'parts', 'part'
            )) for s in splitstrip(
                self.minitage_section.get('dependencies', '')
            ) + minibuild_dependencies ]
        )

        # Defining the python interpreter used to install python stuff.
        # using the one defined in the key 'executable'
        # fallback to sys.executable or
        # python-2.4 if self.name = site-packages-2.4
        # python-2.5 if self.name = site-packages-2.5
        self.executable= None
        if 'executable' in options:
            for lsep in '.', '..':
                if lsep in options['executable']:
                    self.executable = norm_path(os.path.abspath(options.get('executable').strip()))
                else:
                    self.executable = norm_path(options.get('executable').strip())