From 14c234820fbc948b11c09a699012c84490c60658 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 27 Mar 2020 09:19:28 +1300 Subject: [PATCH] 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 --- layerindex/models.py | 7 ------- rrs/admin.py | 6 ------ rrs/tools/rrs_upgrade_history.py | 21 ++++++--------------- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/layerindex/models.py b/layerindex/models.py index 04888be..8ac0cab 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -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'): diff --git a/rrs/admin.py b/rrs/admin.py index a4712f2..445e591 100644 --- a/rrs/admin.py +++ b/rrs/admin.py @@ -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 diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py index 5070cc2..38e258c 100755 --- a/rrs/tools/rrs_upgrade_history.py +++ b/rrs/tools/rrs_upgrade_history.py @@ -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)