Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable python2 travis-ci #3446

Merged
merged 1 commit into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ env:
# The decryption key for the encrypted .github/deploy_key.scitools-docs.enc.
- secure: "N9/qBUT5CqfC7KQBDy5mIWZcGNuUJk3e/qmKJpotWYV+zwOI4GghJsRce6nFnlRiwl65l5oBEcvf3+sBvUfbZqh7U0MdHpw2tHhr2FSCmMB3bkvARZblh9M37f4da9G9VmRkqnyBM5G5TImXtoq4dusvNWKvLW0qETciaipq7ws="
matrix:
- PYTHON_VERSION=2.7 TEST_TARGET=default TEST_MINIMAL=true
- PYTHON_VERSION=2.7 TEST_TARGET=default
- PYTHON_VERSION=2.7 TEST_TARGET=example

- PYTHON_VERSION=3.6 TEST_TARGET=default TEST_MINIMAL=true
- PYTHON_VERSION=3.6 TEST_TARGET=default
- PYTHON_VERSION=3.6 TEST_TARGET=example
Expand All @@ -40,11 +36,7 @@ install:
- >
echo 'Installing miniconda';
export CONDA_BASE="https://repo.continuum.io/miniconda/Miniconda";
if [[ "${PYTHON_VERSION}" == 2* ]]; then
wget --quiet ${CONDA_BASE}2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget --quiet ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh;
fi;
wget --quiet ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p ${HOME}/miniconda;
export PATH="${HOME}/miniconda/bin:${PATH}";

Expand All @@ -65,19 +57,15 @@ install:
# ---------------------------------
- >
echo 'Install Iris dependencies';
CONDA_REQS_FLAGS="";
CONDA_REQS_GROUPS="test";
if [[ "${PYTHON_VERSION}" == 2* ]]; then
CONDA_REQS_FLAGS="${CONDA_REQS_FLAGS} --py2";
fi;
if [[ "${TEST_MINIMAL}" != true ]]; then
CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} all";
fi;
if [[ "${TEST_TARGET}" == 'doctest' ]]; then
CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} docs";
fi;
CONDA_REQS_FILE="conda-requirements.txt";
python requirements/gen_conda_requirements.py ${CONDA_REQS_FLAGS} --groups ${CONDA_REQS_GROUPS} > ${CONDA_REQS_FILE};
python requirements/gen_conda_requirements.py --groups ${CONDA_REQS_GROUPS} > ${CONDA_REQS_FILE};
cat ${CONDA_REQS_FILE};
conda install --quiet -n ${ENV_NAME} --file ${CONDA_REQS_FILE};

Expand Down Expand Up @@ -112,12 +100,12 @@ install:

- python setup.py --quiet install

# JUST FOR NOW : Install latest version of iris-grib.
# TODO : remove when iris doesn't do an integration test requiring iris-grib.
- if [[ "${TEST_MINIMAL}" != true && ${PYTHON_VERSION} == 2* ]]; then
conda install --quiet -n ${ENV_NAME} python-ecmwf_grib;
pip install git+https://github.com/SciTools/[email protected];
fi
# TODO: uncomment and address the 5 failures and 10 errors in iris-grib.
# - if [[ "${TEST_MINIMAL}" != true ]]; then
# conda install --quiet -n ${ENV_NAME} python-eccodes;
# conda install --quiet -n ${ENV_NAME} --no-deps iris-grib;
# fi
Comment on lines +104 to +108
Copy link
Member Author

@bjlittle bjlittle Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull the pin and fix these iris-grib related issues... but not in this PR.


script:
# Capture install-dir: As a test command must be last for get Travis to check
Expand Down
2 changes: 1 addition & 1 deletion requirements/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ------------------------------------------------

# esmpy regridding not available through pip.
#conda: esmpy>=7.0 (only python=2)
#conda: esmpy>=7.0
#gdal : under review -- not tested at present
mo_pack
nc-time-axis
Expand Down
2 changes: 1 addition & 1 deletion requirements/extensions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# struggle. To install these extensions, ensure iris[core] has been installed
# first.

iris_grib;python_version<"3" #conda:
iris-grib #conda:
gdal
31 changes: 5 additions & 26 deletions requirements/gen_conda_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,27 @@
CONDA_PATTERN = '#conda:'


def read_conda_reqs(fname, options):
def read_conda_reqs(fname):
lines = []
with open(fname, 'r') as fh:
for line in fh:
line = line.strip()
if CONDA_PATTERN in line:
line_start = line.index(CONDA_PATTERN) + len(CONDA_PATTERN)
line = line[line_start:].strip()
if 'only python=2' in line:
if 'python=2' in options:
line = line.replace('(only python=2)', '')
lines.append(line)
else:
continue
else:
lines.append(line)
else:
lines.append(line)
lines.append(line)
return lines


def compute_requirements(requirement_names=('core', ), options=None):
def compute_requirements(requirement_names=('core', )):
conda_reqs_lines = []

if 'python=2' in options:
conda_reqs_lines.append('python=2.*')
else:
conda_reqs_lines.append('# Python 3 conda configuration')

for req_name in requirement_names:
fname = os.path.join(REQS_DIR, '{}.txt'.format(req_name))
if not os.path.exists(fname):
raise RuntimeError('Unable to find the requirements file for {} '
'in {}'.format(req_name, fname))
conda_reqs_lines.extend(read_conda_reqs(fname, options))
conda_reqs_lines.extend(read_conda_reqs(fname))
conda_reqs_lines.append('')

return conda_reqs_lines
Expand All @@ -70,21 +56,14 @@ def main():
"--groups", nargs='*', default=[],
help=("Gather requirements for these given named groups "
"(as found in the requirements/ folder)"))
parser.add_argument(
"--py2", action="store_true",
help="Build the conda requirements for a python 2 installation")

args = parser.parse_args()

requirement_names = args.groups
requirement_names.insert(0, 'core')
requirement_names.insert(0, 'setup')

options = []
if args.py2:
options.append('python=2')

print('\n'.join(compute_requirements(requirement_names, options)))
print('\n'.join(compute_requirements(requirement_names)))


if __name__ == '__main__':
Expand Down