RRS: drop support for parsing older python2-based metadata

With Python 2.x going out of support, we shouldn't have any references
to it and unfortunately that includes the ability to parse older
releases; however that's a sacrifice we'll have to make. The data
structures are still there, but we'll remove those later.

Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
This commit is contained in:
Paul Eggleton 2020-03-27 09:19:28 +13:00
parent f3202c38e6
commit 14c234820f
3 changed files with 6 additions and 28 deletions

View File

@ -49,13 +49,6 @@ class PythonEnvironment(models.Model):
cmd = self.python_command
return cmd
@staticmethod
def get_default_python2_environment():
for env in PythonEnvironment.objects.all().order_by('id'):
if env.name.replace(' ', '').lower().startswith(('python2', 'py2')):
return env
return None
@staticmethod
def get_default_python3_environment():
for env in PythonEnvironment.objects.all().order_by('id'):

View File

@ -22,9 +22,6 @@ class MaintenancePlanLayerBranchFormSet(BaseInlineFormSet):
def __init__(self, *args, **kwargs):
from layerindex.models import PythonEnvironment
initialfields = {}
py2env = PythonEnvironment.get_default_python2_environment()
if py2env:
initialfields['python2_environment'] = py2env.id
py3env = PythonEnvironment.get_default_python3_environment()
if py3env:
initialfields['python3_environment'] = py3env.id
@ -36,9 +33,6 @@ class MaintenancePlanLayerBranchFormSet(BaseInlineFormSet):
def empty_form(self):
from layerindex.models import PythonEnvironment
form = super(MaintenancePlanLayerBranchFormSet, self).empty_form
py2env = PythonEnvironment.get_default_python2_environment()
if py2env:
form.fields['python2_environment'].initial = py2env
py3env = PythonEnvironment.get_default_python3_environment()
if py3env:
form.fields['python3_environment'].initial = py3env

View File

@ -38,21 +38,12 @@ if not fetchdir:
def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitbake_map, initial=False):
from layerindex.models import PythonEnvironment
from rrs.models import Release
if commitdate < maintplanlayerbranch.python3_switch_date:
# Python 2
if maintplanlayerbranch.python2_environment:
cmdprefix = maintplanlayerbranch.python2_environment.get_command()
else:
cmdprefix = 'python'
# Ensure we're using a bitbake version that is python 2 compatible
if commitdate > datetime(2016, 5, 10):
commitdate = datetime(2016, 5, 10)
# Python 3-only these days
if maintplanlayerbranch.python3_environment:
cmdprefix = maintplanlayerbranch.python3_environment.get_command()
else:
# Python 3
if maintplanlayerbranch.python3_environment:
cmdprefix = maintplanlayerbranch.python3_environment.get_command()
else:
cmdprefix = 'python3'
cmdprefix = 'python3'
bitbake_rev = utils.runcmd(['git', 'rev-list', '-1', '--before=%s' % str(commitdate), 'origin/master'],
bitbakepath, logger=logger)
@ -244,7 +235,7 @@ if __name__=="__main__":
parser = optparse.OptionParser(usage = """%prog [options]""")
# Starting date of the yocto project 1.6 release
DEFAULT_SINCE_DATE = '2013-11-11'
DEFAULT_SINCE_DATE = '2016-06-02'
parser.add_option("-s", "--since",
help="Specify initial date for importing recipe upgrades (default '%s')" % DEFAULT_SINCE_DATE,
action="store", dest="since", default=DEFAULT_SINCE_DATE)