From 3065b0d64dbc22e1cf9f416e002275783309cfeb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Mar 2020 14:11:37 -0700 Subject: [PATCH 1/4] Add travis-ci tests with python3.7 and python3.8 Motivated by https://github.com/ESMCI/manage_externals/issues/135 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b32f81bd28..cecade0ad8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7" + - "3.8" matrix: include: - os: osx From 7f41c563dff33edd15e1ccf628f71f80ccf1ce36 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Mar 2020 14:19:16 -0700 Subject: [PATCH 2/4] Fix pylint issue Travis-ci tests with python3 were failing with: ************* Module manic.repository_svn R1724:221,12: Unnecessary "else" after "continue" (no-else-continue) This should fix the problem. (I'm not sure why this started failing now: this is old code. Maybe pylint recently was updated to add this check?) --- manic/repository_svn.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manic/repository_svn.py b/manic/repository_svn.py index 2f0d4d848c..408ed84676 100644 --- a/manic/repository_svn.py +++ b/manic/repository_svn.py @@ -220,9 +220,8 @@ def xml_status_is_dirty(svn_output): continue if item == SVN_UNVERSIONED: continue - else: - is_dirty = True - break + is_dirty = True + break return is_dirty # ---------------------------------------------------------------- From 7e8474bbc836115b0403bde00ff5e8f664517daa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Mar 2020 14:57:17 -0700 Subject: [PATCH 3/4] Remove testing on mac os This is failing. It's using python2, which is no longer supported (though I don't know if that's why it's failing). I don't see the point in trying to update it to use python3, since I feel we have sufficient coverage with our linux testing, so for now I'm just removing it. --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index cecade0ad8..1990cb9604 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,3 @@ -# NOTE(bja, 2017-11) travis-ci dosen't support python language builds -# on mac os. As a work around, we use built-in python on linux, and -# declare osx a 'generic' language, and create our own python env. - language: python os: linux python: @@ -11,17 +7,6 @@ python: - "3.6" - "3.7" - "3.8" -matrix: - include: - - os: osx - language: generic - before_install: - # NOTE(bja, 2017-11) update is slow, 2.7.12 installed by default, good enough! - # - brew update - # - brew outdated python2 || brew upgrade python2 - - pip install virtualenv - - virtualenv env -p python2 - - source env/bin/activate install: - pip install -r test/requirements.txt before_script: From 37e4c4a54fabb9a138125c7f6259024d1f6dffc8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Mar 2020 15:20:39 -0700 Subject: [PATCH 4/4] Do not update dictionary in-place in loop Trying to update the dictionary in-place in the loop leads to an error in python 3.8 ("dictionary keys changed during iteration"). Instead, create a copy of the dictionary, modified as needed. Resolves ESMCI/manage_externals#135 --- manic/sourcetree.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/manic/sourcetree.py b/manic/sourcetree.py index 3a63835c78..b9c9c21082 100644 --- a/manic/sourcetree.py +++ b/manic/sourcetree.py @@ -299,18 +299,20 @@ def status(self, relative_path_base=LOCAL_PATH_INDICATOR): for comp in load_comps: printlog('{0}, '.format(comp), end='') stat = self._all_components[comp].status() + stat_final = {} for name in stat.keys(): # check if we need to append the relative_path_base to # the path so it will be sorted in the correct order. - if not stat[name].path.startswith(relative_path_base): - stat[name].path = os.path.join(relative_path_base, - stat[name].path) - # store under key = updated path, and delete the - # old key. - comp_stat = stat[name] - del stat[name] - stat[comp_stat.path] = comp_stat - summary.update(stat) + if stat[name].path.startswith(relative_path_base): + # use as is, without any changes to path + stat_final[name] = stat[name] + else: + # append relative_path_base to path and store under key = updated path + modified_path = os.path.join(relative_path_base, + stat[name].path) + stat_final[modified_path] = stat[name] + stat_final[modified_path].path = modified_path + summary.update(stat_final) return summary