Skip to content

Commit

Permalink
Merge pull request #138 from billsacks/add_python38_tests
Browse files Browse the repository at this point in the history
Fixes for python3.8, and tweak travis-ci testing

- Critical fix needed for python3.8
- pylint fix needed for all versions of python 3
- Add python3.7 and python3.8 testing through travis-ci
- Remove travis-ci testing on Mac OS (which was using python2, and was
  failing)

User interface changes?: No

Fixes ESMCI/cime#135 ("dictionary keys changed during iteration" when
running checkout_externals)

Testing: 'make lint', 'make test'
  test removed: travis-ci testing on Mac OS
  unit tests: pass
  system tests: pass
  manual testing:

With these diffs in a CESM checkout:

```diff
diff --git a/Externals.cfg b/Externals.cfg
index b943c25..6b0f03e 100644
--- a/Externals.cfg
+++ b/Externals.cfg
@@ -39,7 +39,7 @@ required = True
 tag = release-cesm2.0.03
 protocol = git
 repo_url = https://github.com/ESCOMP/mosart
-local_path = components/mosart
+local_path = ./components/mosart
 required = True

 [pop]
```

ensured that `manage_externals -S` gives the exact same output now as
before.
  • Loading branch information
billsacks committed Mar 3, 2020
2 parents 34fbf55 + 37e4c4a commit fde04e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
17 changes: 2 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
# 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:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
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
- "3.7"
- "3.8"
install:
- pip install -r test/requirements.txt
before_script:
Expand Down
5 changes: 2 additions & 3 deletions manic/repository_svn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ----------------------------------------------------------------
Expand Down
20 changes: 11 additions & 9 deletions manic/sourcetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit fde04e4

Please sign in to comment.