Skip to content

Commit

Permalink
Include IronPython in .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ysitu committed Jul 3, 2014
1 parent 1cc106b commit a1c0d95
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 56 deletions.
86 changes: 60 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,59 @@ matrix:

include:
- python: "pypy"
env: OPTIONAL_DEPS=no
env: PYTHON_VM=pypy OPTIONAL_DEPS=no
- python: "3.4"
env: OPTIONAL_DEPS=source
env: PYTHON_VM=cpython OPTIONAL_DEPS=source
- python: "2.7"
env: PYTHON_VM=ipy OPTIONAL_DEPS=no

allow_failures:
- env: OPTIONAL_DEPS=source
- env: PYTHON_VM=ipy OPTIONAL_DEPS=no
- env: PYTHON_VM=cpython OPTIONAL_DEPS=source

env:
global:
# Install from wheels *only*.
- PIPINSTALL="pip install -v --use-wheel --no-index --find-links=http://sunpy.cadair.com/wheelhouse/"
- NXOPTDEPS=""

matrix:
- OPTIONAL_DEPS=pip
- OPTIONAL_DEPS=no
- PYTHON_VM=cpython OPTIONAL_DEPS=pip
- PYTHON_VM=cpython OPTIONAL_DEPS=no

before_install:
### Prepare the system to install prerequisites or dependencies
- uname -a
- printenv
- pip install --upgrade setuptools
- pip install --upgrade pip
- pip install wheel
- pip --version
- sudo apt-get update -qq
- if [[ "${PYTHON_VM}" != ipy ]]; then
pip install --upgrade setuptools;
pip install --upgrade pip;
pip install wheel;
pip --version;
else
sudo apt-get install -qq mono-devel;
pushd ..;
curl -L -o /tmp/IronPython-2.7.5b2.zip "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=ironpython&DownloadId=815751&FileTime=130455203824130000&Build=20919";
unzip /tmp/IronPython-2.7.5b2.zip;
curl -L -o /tmp/decorator-3.4.0.tar.gz https://pypi.python.org/packages/source/d/decorator/decorator-3.4.0.tar.gz;
pushd /tmp;
tar xf decorator-3.4.0.tar.gz;
popd;
cp /tmp/decorator-3.4.0/src/decorator.py IronPython-2.7.5b2/Lib;
curl -L -o /tmp/nose-1.3.3.tar.gz https://pypi.python.org/packages/source/n/nose/nose-1.3.3.tar.gz;
pushd /tmp;
tar xf nose-1.3.3.tar.gz;
popd;
cp -R /tmp/nose-1.3.3/nose IronPython-2.7.5b2/Lib;
popd;
fi

install:
### Install any prerequisites or dependencies necessary to run the build.

# Skipping pydot (not 3.x compatible)
# Skipping gdal (errors during pip installs)
- sudo apt-get update -qq
- if [[ "${OPTIONAL_DEPS}" =~ pip|source ]]; then
sudo apt-get install graphviz libsuitesparse-dev;
fi
Expand All @@ -69,43 +91,55 @@ install:

before_script:
### Use this to prepare your build for testing
- pip install --upgrade nose
- pip install --upgrade coverage
- pip install --upgrade coveralls
- if [[ "${PYTHON_VM}" != ipy ]]; then
pip install --upgrade nose coverage coveralls;
fi

script:
- printenv PWD
- pip install .

- export NX_INSTALL=`pip show networkx | grep Location | awk '{print $2"/networkx"}'`
- if [[ "${PYTHON_VM}" != ipy ]]; then
pip install .;
export NX_INSTALL=`pip show networkx | grep Location | awk '{print $2"/networkx"}'`;
fi

# nose 1.3.0 does not tell coverage to only cover the requested
# package (except during the report). So to restrict coverage, we must
# inform coverage through the .coveragerc file.
- cp .coveragerc $NX_INSTALL
- cp setup.cfg $NX_INSTALL
- if [[ "${PYTHON_VM}" != ipy ]]; then
cp .coveragerc $NX_INSTALL;
cp setup.cfg $NX_INSTALL;
fi

# Move to new directory so that networkx is not imported from repository.
# Why? Because we want the tests to make sure that NetworkX was installed
# correctly. Example: setup.py might not have included some submodules.
# Testing from the git repository cannot catch a mistake like that.
#
# Export current directory for logs.
- cd $NX_INSTALL
- printenv PWD
- if [[ "${PYTHON_VM}" != ipy ]]; then
cd $NX_INSTALL;
printenv PWD;
fi

# Run nosetests.
- nosetests --verbosity=2 --with-coverage --cover-package=networkx
# Run nosetests.
- if [[ "${PYTHON_VM}" != ipy ]]; then
nosetests --verbosity=2 --with-coverage --cover-package=networkx;
else
mono ../IronPython-2.7.5b2/ipy.exe -X:ExceptionDetail -X:FullFrames -c 'from nose import main; main()' \--verbosity=2;
fi

after_success:
# We must run coveralls from the git repo. But we ran tests from the
# installed directory. The .coverage file looks like it contains absolute
# paths, but coveralls does not seem to care.
- cp .coverage $TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR
#
# Report coverage for 2.7 and 3.4 only.
- if [[ "${TRAVIS_PYTHON_VERSION}${OPTIONAL_DEPS}" =~ 2\.7pip|3\.4source ]]; then
coveralls;
- if [[ "${PYTHON_VM}" != ipy ]]; then
cp .coverage $TRAVIS_BUILD_DIR;
cd $TRAVIS_BUILD_DIR;
if [[ "${TRAVIS_PYTHON_VERSION}${OPTIONAL_DEPS}" =~ 2\.7pip|3\.4source ]]; then
coveralls;
fi;
fi

notifications:
Expand Down
29 changes: 1 addition & 28 deletions networkx/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import sys
import time
import datetime
import subprocess

basedir = os.path.abspath(os.path.split(__file__)[0])

Expand Down Expand Up @@ -124,33 +123,7 @@ def get_revision():
hgdir = os.path.join(basedir, '..', '.hg')
gitdir = os.path.join(basedir, '..', '.git')

if os.path.isdir(hgdir):
vcs = 'mercurial'
try:
p = subprocess.Popen(['hg', 'id'],
cwd=basedir,
stdout=subprocess.PIPE)
except OSError:
# Could not run hg, even though this is a mercurial repository.
pass
else:
stdout = p.communicate()[0]
# Force strings instead of unicode.
x = list(map(str, stdout.decode().strip().split()))

if len(x) == 0:
# Somehow stdout was empty. This can happen, for example,
# if you're running in a terminal which has redirected stdout.
# In this case, we do not use any revision/tag info.
pass
elif len(x) == 1:
# We don't have 'tip' or anything similar...so no tag.
revision = str(x[0])
else:
revision = str(x[0])
tag = str(x[1])

elif os.path.isdir(gitdir):
if os.path.isdir(gitdir):
vcs = 'git'
# For now, we are not bothering with revision and tag.

Expand Down
5 changes: 3 additions & 2 deletions networkx/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# All rights reserved.
# BSD license.
import sys
import subprocess
import uuid

import networkx as nx
Expand Down Expand Up @@ -110,11 +109,13 @@ def default_opener(filename):
The path of the file to be opened.
"""
from subprocess import call

cmds = {'darwin': ['open'],
'linux2': ['xdg-open'],
'win32': ['cmd.exe', '/C', 'start', '']}
cmd = cmds[sys.platform] + [filename]
subprocess.call(cmd)
call(cmd)


def dict_to_numpy_array(d,mapping=None):
Expand Down

0 comments on commit a1c0d95

Please sign in to comment.