aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/models.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-06-07 16:52:33 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-06-12 11:33:08 +1200
commitfa3ff04095da83e380e09116c44e7c42394f7822 (patch)
tree6823d0e6e840434a73a8870ccc2e2addcf77b034 /layerindex/models.py
parent3919f74a2a60b18f730cf75cc8cedc194bc52e36 (diff)
downloadopenembedded-core-contrib-fa3ff04095da83e380e09116c44e7c42394f7822.tar.gz
Handle Python 2 and Python 3 branches in the same index
Add a model to support setting a python command and virtualenv per branch, which allows you to parse master with python3 and krogoth with python2 for example. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/models.py')
-rw-r--r--layerindex/models.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/layerindex/models.py b/layerindex/models.py
index e753fbe556..3a5796d8f4 100644
--- a/layerindex/models.py
+++ b/layerindex/models.py
@@ -1,6 +1,6 @@
# layerindex-web - model definitions
#
-# Copyright (C) 2013 Intel Corporation
+# Copyright (C) 2013-2016 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
@@ -14,12 +14,29 @@ import re
import posixpath
+class PythonEnvironment(models.Model):
+ name = models.CharField(max_length=50)
+ python_command = models.CharField(max_length=255, default='python')
+ virtualenv_path = models.CharField(max_length=255, blank=True)
+
+ def get_command(self):
+ if self.virtualenv_path:
+ cmd = '. %s/bin/activate; %s' % (self.virtualenv_path, self.python_command)
+ else:
+ cmd = self.python_command
+ return cmd
+
+ def __str__(self):
+ return self.name
+
+
class Branch(models.Model):
name = models.CharField(max_length=50)
bitbake_branch = models.CharField(max_length=50)
short_description = models.CharField(max_length=50, blank=True)
sort_priority = models.IntegerField(blank=True, null=True)
updates_enabled = models.BooleanField('Enable updates', default=True, help_text='Enable automatically updating layer metadata for this branch via the update script')
+ update_environment = models.ForeignKey(PythonEnvironment, blank=True, null=True, on_delete=models.SET_NULL)
updated = models.DateTimeField(auto_now = True, default = datetime.now)