def _call(self, f):
     """On call, verify that our recipes are used"""
     initialization = True
     monkey_patch_recipes(buildout)
     Options._buildout = buildout
     ret = Options._old_call(self, f)
     return ret
예제 #2
0
 def write_appcfg_script(self, bin):
     """Generates the app configuration script in bin."""
     options = self.options.copy()
     options['eggs'] = ''
     run_file = self.options['appserver-run-file']
     options['entry-points'] = 'appcfg=appcfg:%s' % run_file
     options['arguments'] = '%r, locals()' % bin
     options = Options(self.buildout, self.name, options)
     scripts = Scripts(self.buildout, self.name, options)
     scripts.install()
 def _initialize(self, *args, **kwargs):
     """On intialization, install our recipe instead"""
     Options._old_initialize(self, *args, **kwargs)
     recipe = self.get("recipe")
     if not recipe:
         return
     name = self.name
     reqs, entry = _recipe(self._data)
     mappings = {
         ("zc.recipe.egg", "default"): ("minitage.recipe.scripts", "default"),
         ("zc.recipe.egg", "script"): ("minitage.recipe.scripts", "default"),
         ("zc.recipe.egg", "scripts"): ("minitage.recipe.scripts", "default"),
         ("zc.recipe.egg", "Custom"): ("minitage.recipe.scripts", "default"),
         ("zc.recipe.egg", "Eggs"): ("minitage.recipe.egg", "default"),
         ("zc.recipe.egg", "eggs"): ("minitage.recipe.egg", "default"),
         ("zc.recipe.cmmi", "default"): ("minitage.recipe.cmmi", "default"),
     }
     reqsa, entrya = mappings.get((reqs, entry), (None, None))
     if reqsa:
         recipe_class = _install_and_load(reqsa, "zc.buildout", entrya, self.buildout)
         self.recipe = recipe_class(buildout, name, self)
         self.recipe.logger.info("Replaced %s with %s" % ((reqs, entry), (reqsa, entrya)))
 def _initialize(self, *args, **kwargs):
     """On intialization, install our recipe instead"""
     Options._old_initialize(self, *args, **kwargs)
     recipe = self.get('recipe')
     if not recipe:
         return
     name = self.name
     reqs, entry = _recipe(self._data)
     mappings = {
         ('zc.recipe.egg', 'default'): ('minitage.recipe.scripts', 'default'),
         ('zc.recipe.egg', 'script'): ('minitage.recipe.scripts', 'default'),
         ('zc.recipe.egg', 'scripts'): ('minitage.recipe.scripts', 'default'),
         ('zc.recipe.egg', 'Custom'): ('minitage.recipe.scripts', 'default'),
         ('zc.recipe.egg', 'Eggs'): ('minitage.recipe.egg', 'default'),
         ('zc.recipe.egg', 'eggs'): ('minitage.recipe.egg', 'default'),
         ('zc.recipe.cmmi', 'default'): ('minitage.recipe.cmmi', 'default'),
     }
     reqsa, entrya = mappings.get((reqs, entry), (None, None))
     if reqsa:
         recipe_class = _install_and_load(reqsa, 'zc.buildout', entrya, self.buildout)
         self.recipe = recipe_class(buildout, name, self)
         self.recipe.logger.info(
             "Replaced %s with %s" % ((reqs, entry), (reqsa, entrya))
         )
예제 #5
0
    def write_server_script(self, name, bin):
        """Generates bin script with given name."""

        var = os.path.join(self.buildout['buildout']['parts-directory'], '%s_var' % self.name)
        if not os.path.isdir(var):
            os.makedirs(var)

        script_name = self.get_appserver_script_name().partition('.')[0]

        options = self.options.copy()
        options['eggs'] = ''
        run_file = '_' + self.options['appserver-run-file']
        options['entry-points'] = '%s=%s:%s' % (name, script_name, run_file)
        options['initialization'] = dev_appserver_initialization % dict(var=var, script_name=script_name)
        options['initialization'] += '\n' + self.options.get('initialization', '')
        options['arguments'] = '%r, locals()' % bin
        options = Options(self.buildout, self.name, options)
        scripts = Scripts(self.buildout, self.name, options)
        scripts.install()
예제 #6
0
 def update_buildout_data(cls, buildout):
     import gitpy
     repository = cls.get_repository()
     branch = repository.getCurrentBranch()
     try:
         remote = branch.getRemoteBranch() if branch is not None else None
     except gitpy.exceptions.NonexistentRefException:
         remote = None
     head = repository.getHead()
     from zc.buildout.buildout import Options
     data = {}
     data['version'] = cls.extract_version_tag().lstrip('v')
     data['author'] = head.getAuthorName()
     data['author_email'] = head.getAuthorEmail()
     data['git_local_branch'] = repr(branch.name if branch is not None else
                                     '(Not currently on any branch)')
     data['git_remote_tracking_branch'] = repr(remote.getNormalizedName(
     ) if remote is not None else '(No remote tracking)')
     data['git_remote_url'] = repr(remote.remote.url if remote is not None
                                   else '(Not remote tracking)')
     data['head_subject'] = repr(
         cls.strip_mako_characters(head.getSubject()))
     data['head_message'] = repr(
         cls.strip_mako_characters(head.getMessageBody()))
     data['head_hash'] = repr(head.hash)
     data['git_commit_date'] = repr(
         datetime.datetime.fromtimestamp(head.getDate()).isoformat(' '))
     diff = execute_async("git diff --patch --no-color", shell=True)
     diff.wait()
     data['dirty_diff'] = repr(
         cls.strip_mako_characters(diff.get_stdout().decode("utf-8")))
     data['homepage'] = repr(cls.get_homepage())
     if buildout.get("project").get("homepage"):
         data['homepage'] = repr(buildout.get("project").get("homepage"))
     buildout._data.update(
         {SECTION_NAME: Options(buildout, SECTION_NAME, data)})
예제 #7
0
 def write_extra_scripts(self):
     options = self.options.copy()
     options['eggs'] = ''
     options = Options(self.buildout, self.name, options)
     scripts = Scripts(self.buildout, self.name, options)
     scripts.install()
예제 #8
0
파일: bo.py 프로젝트: whitmo/steamroller
 def __init__(self, buildout, section, data):
     Options.__init__(self, buildout, section, data)
     self.sub_all()