From 23b300bb65dcbdcec14b37f9a1e7363e44fcc758 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com>
Date: Thu, 21 Feb 2013 15:28:56 +0100
Subject: [PATCH] Add helper method to set "location" parameter in librecipe.

Set to buildout['buildout']['parts-directory'] + name.
Used in 50% of the recipes.
---
 slapos/recipe/librecipe/generic.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/slapos/recipe/librecipe/generic.py b/slapos/recipe/librecipe/generic.py
index fb3b006ef..a3d9bb940 100644
--- a/slapos/recipe/librecipe/generic.py
+++ b/slapos/recipe/librecipe/generic.py
@@ -61,6 +61,10 @@ class GenericBaseRecipe(object):
 
     self._ws = self.getWorkingSet()
 
+    if not options.get('location'):
+      options['location'] = os.path.join(
+          buildout['buildout']['parts-directory'], self.name)
+
   def update(self):
     """By default update method does the same thing than install"""
     return self.install()
@@ -226,3 +230,8 @@ class GenericBaseRecipe(object):
     url = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
 
     return url
+
+  def setLocationOption(self):
+    if not self.options.get('location'):
+      self.options['location'] = os.path.join(
+          self.buildout['buildout']['parts-directory'], self.name)
-- 
2.30.9